Skip to main content
Question

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


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.

3 replies

takashi
Evangelist
  • 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

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+28
  • Contributor
  • 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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings