Image Colormap Array Order

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
xinito

Image Colormap Array Order

Post by xinito »

Hello,

I use Magick to segment an image and then want to query an index i in the colormap array.

This index i is the color of which the pixels account for the second largest number of pixels in the image.

My question is that in which order is the colormap (color palette array) is ordered? If there is no order, is there some method that I can query that index?

Thanks
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You did not mention which language interface you are using. With MagickCore you can query the colormap directly as image->colormap and the colormap index of a particular pixel with GetIndexes().
xinito

Post by xinito »

I use C++ API. is the colormap index in some order? for example, image->colormap[0] is the color of the pixels that have the largest number in the image or that is of the smallest intensity?

Thanks
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Perhaps there is an ordering, we can't recall. To verity try -segment from the command line and add -verbose. That will display the cluster centers and frequency which may reveal the cluster ordering.
Post Reply