Colors of an image contained in another image

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
YvesTan
Posts: 4
Joined: 2015-02-06T08:17:21-07:00
Authentication code: 6789

Colors of an image contained in another image

Post by YvesTan »

Hello,

I wish to make the following comparison:

On one side, I have a simple image (A) which contains certain colors :
Image

On the other hand, I have another image (B) that contains a color palette :
Image

I want to know if the dominant colors in image A are contained in image B

how do I proceed?

thank you :)

(french user : sorry to my bad english)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Colors of an image contained in another image

Post by fmw42 »

YvesTan
Posts: 4
Joined: 2015-02-06T08:17:21-07:00
Authentication code: 6789

Re: Colors of an image contained in another image

Post by YvesTan »

Thank you for your answer

I tried:

Code: Select all

convert image_B.gif -colors 256 -depth 8 -format "%c" histogram:info:
And loop on results and push HEXA on database

Code: Select all

convert image_A.gif -colors 256 -depth 8 -format "%c" histogram:info:
And loop on resultst and compare each HEXA with image B results on database

But I think the problem is that I use a limited palette too? Not enough intervals colors?
YvesTan
Posts: 4
Joined: 2015-02-06T08:17:21-07:00
Authentication code: 6789

Re: Colors of an image contained in another image

Post by YvesTan »

Maybe I'm not using the right method.

The project is:

- Taking a picture of a liquid for analysis (like this: http://www.poolplaza.com/pool-school/pH_testing.shtml)

- We try to determine in which areas of the range "red phenol" the liquid is (negative, not determined, positive)

Thank you for your advice ;)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Colors of an image contained in another image

Post by snibgo »

Perhaps you have a sample colour patch and want to find that in the colour chart of pH values.

So, scale your sample to a single pixel. Then do a subimage-search for that pixel in the colour chart o find the closest match.
snibgo's IM pages: im.snibgo.com
YvesTan
Posts: 4
Joined: 2015-02-06T08:17:21-07:00
Authentication code: 6789

Re: Colors of an image contained in another image

Post by YvesTan »

Hello,

My apologies for the response time. I solved my problem by calculating the distance Delta E

Thank you for your ideas :)
Post Reply