Skip to main content
Question

Advanced Raster Cell Value Calculation-Identify dominant color in a jpg/raster

  • August 22, 2018
  • 3 replies
  • 28 views

My goal is to identify the dominant color in a JPG. For instance, your JPG is mostly 'green'; that is, most of the JPG pixels fall somewhere in the 'green' hue. I've looked into using a Python script, but unfortunately my Python skills are limited so that option has been troublesome.

I've also tried the 'RasterCellNeighborSummer', custom transformer but I don't get any output. I've attached a basic workspace that just feeds in a test JPG to the 'RasterCellNeighborSummer' transformer.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

takashi
Celebrity
  • 7843 replies
  • August 22, 2018

Hi @jamiefoutz, sorry, there seems to be a bug in the RasterCellNeighborSummer transformer.

The RasterConvolver transformer has been newly introduced in FME 2018.1. Try this one if you are using the latest version of FME.


Forum|alt.badge.img+2
  • 719 replies
  • August 22, 2018

Hi @jamiefoutz,

Another option might be to explore the RasterExpressionEvaluator using conditional statements. This article might help you get started: https://knowledge.safe.com/articles/1226/using-conditions-with-the-rasterexpressionevaluato.html


jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • August 23, 2018

This is an interesting challenge. Attached is a custom transformer that returns the Hue in degrees of the most commonly occurring colour, within a tolerance range. It is unfortunately locked as it leverages some custom transformers I'm not allowed to share publicly. The description includes an overview of the methodology.

 

mainimagehue.fmx