# How to differentiate two objects of different color?

Hi
I was looking for a solution to differentiate two objects ( one yellow circle inside a Gray circle) that are moving together. Can anyone help me in this regard?
Thanks

2017-05-02-121508

Rizwan --

Thank you for the EXAMPLE IMAGE (of OLIVES and PIMENTOS [ ; - ) ] ) and the ADDITIONAL INFORMATION.

Based on that, If I was tackling this challenge, I might use a the type of procedure shown below.

I hope this information is helpful.

-- Matt

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Open the IMAGE
(I played with yours a bit . . . This shows a "time lapse" arranged vertically.  This could be a sequence with different images in each frame or you could pull out the information from this image and subtract the position of the upper left corner of each "frame" from the coordinates to get the per frame object coordinates.)

Create a SMART THRESHOLD to find all of the OLIVES.

Perform a COUNT to identify and locate all of the OLIVES
(with FILL HOLES on, the PIMENTOS are included in the OLIVES)
(save the OLIVE POSITIONS at this point)

Save the OLIVE BOUNDARIES on in the FEATURES MANAGER and then clear the OLIVE BOUNDARIES from the IMAGE

Change the MEASUREMENTS to ROIS in the FEATURES MANAGER and then apply the ROIS back onto the IMAGE and create a SMART THRESHOLD for PIMENTO FOREGROUND and OLIVE BACKGROUND

Perform the COUNT on the PIMENTOS and then you have the position of each PIMENTO.

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Here is a bit of a different take on the same challenge.  The OLIVE MASK and the PIMENTO MASK were found with two SMART THRESHOLDS.  The COLOR COMPOSITE IMAGE is an overlay of OLIVES (GREEN) and PIMENTOS (RED).

• 2017-05-01-192423

Rizwan --

Without seeing the type of image you are working with, we are flying a bit blind trying to assist you.

My attempt is below.

I hope this information is helpful.

-- Matt

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Open an image

Set a THRESHOLD that identifies the objects

Identify the objects using the COUNT function

Measure the COLOR of the objects

(ORDERED by RED INTENSITY)

(ORDERED by GREEN INTENSITY)

(ORDERED by BLUE INTENSITY)

Classified by LEARNING CLASSIFIER (GREEN OUTLINE on YELLOW OBJECT, BLUE OUTLINE on NOT YELLOW OBJECTS)

Now the CLASSIFIER can be run on any image

And the POSITION of objects that match the CLASSIFIER (1 = YELLOW, 2 = NOT YELLOW) can extracted and recorded

Repeat

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Another method would be to identify the objects that you are interested in by a SMART THRESHOLD to identify the object that you are interested in and then find its location in every image.

• edited May 2017
Hi @mbatchelor
Thanks for your reply. To be more precise on my query,Here's attached a schematic. Here the green circle is moving with the inner red circle within it. I need to track both of their position. Can you have a look please? Thanks.

• Thanks @mbatchelor ;
I'm gonna try this out right now !