remap problem
Posted: 2013-01-31T07:26:12-07:00
I'm trying to remap images to 12 predefined colours to create an index of how much of each colour is represented in each image. However I'm not happy with the way my command is currently remapping colours. An example will show my problem:
I'm running the command like:
input.jpg:
colors.bmp: http://static2.yaymicro.com/pub/examples/colors.bmp (small image, only 12 pixels)
output.bmp: http://static2.yaymicro.com/pub/examples/output.bmp
I'm actually running the command as:
but I'm getting the exact same output with the output.bmp so it's easier to show what I'm not happy with.
I've tried different methods, but I end up getting what I would consider to be wrong colours for the remaps. The part of the image that is clearly orange, ends up being red. If I calculate the total distance of the RGB colours, it's closer to orange than to red. I'm also clearly not interested in the pink part, where I feel the image is grey or white. Doing dithering removes the pink parts and replaces them with grey and white, but the orange is still red.
How does ImageMagick do it's nearest neighbour calculations?
Any other way to use ImageMagick to do get the amount of predefined colours in an image?
Bjorn
_________________________________________________________________
Version: ImageMagick 6.8.0-7 2012-12-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenCL
I'm running the command like:
Code: Select all
convert input.jpg -colorspace RGB -dither none -remap colors.bmp output.bmp
colors.bmp: http://static2.yaymicro.com/pub/examples/colors.bmp (small image, only 12 pixels)
output.bmp: http://static2.yaymicro.com/pub/examples/output.bmp
I'm actually running the command as:
Code: Select all
convert input.jpg -colorspace RGB -dither none -remap -format %c histogram:info:-
I've tried different methods, but I end up getting what I would consider to be wrong colours for the remaps. The part of the image that is clearly orange, ends up being red. If I calculate the total distance of the RGB colours, it's closer to orange than to red. I'm also clearly not interested in the pink part, where I feel the image is grey or white. Doing dithering removes the pink parts and replaces them with grey and white, but the orange is still red.
How does ImageMagick do it's nearest neighbour calculations?
Any other way to use ImageMagick to do get the amount of predefined colours in an image?
Bjorn
_________________________________________________________________
Version: ImageMagick 6.8.0-7 2012-12-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenCL