compare two pictures of color

asked 2020-07-26 07:17:32 -0600

bgengine gravatar image

updated 2020-11-12 12:17:03 -0600

Hi,

Whats the best method to compare two pictures of mainly black color , (or two pictures of mainly red color) I'm looking at a specific location on an image and am hoping to see a black colored wire ( or a red coloured wire) in that location. If the wire is not in that location i would see either a gray backround (or a green backround if looking for red cable) .

What I want to ensure is every time I check the location I see a Black shade ( which indicates a Black wire) and must ensure there is no gray backround seen. If all gray background is seen then this indicates the wire is not present if some gray background is seen then this indicates the wire might be present , but is not in the exact correct location.

Bearing in mind that in my picture Black can sometimes how up as dark gray, what the best way to distinguish between the cable and the background and whats the best method to ensure there is no background in the image.

I'm looking at template match , but from what i see it does not quite compare colors.

Can I get the average of value of colors in an image and do a comparision against a master image ? how could I do this ? would it work ?

all help greatly appreciated thanks

The Picture above has black wires turning at an almost 90 degree angle, this is bad. The first picture has wires turning gradually , this is good.

I'd like to inspect each and ensure the wires turn gradually, and indicate a filure if they do not.

Below are images:

Wires in correct location : image description

Wires in Wrong location: image description

Image without any wires : image description

I was thinking of first identifying and location the component ( shown in Green below) and then selecting 2 X ROI relative to that green area. shown in red. Then compare the color in these red boxes against the colors of the backgrounds ( with no wires) ... is this possible how could i do it ? I know how to identify the 2 X ROI but not sure how i can compare the colors . Also, one red box has a backround that is very similiar to the cable.

C:\fakepath\test.png

edit retag flag offensive close merge delete

Comments

you probably should show your images here ;)

berak gravatar imageberak ( 2020-07-26 07:22:10 -0600 )edit
1

Indeed. Please post your images.

sjhalayka gravatar imagesjhalayka ( 2020-07-26 20:32:03 -0600 )edit

To start you off with: to find the difference between two images, you can use subtraction (subtraction is literally, the difference operator, like how addition is the sum operator).

sjhalayka gravatar imagesjhalayka ( 2020-07-26 21:09:59 -0600 )edit
1

Hi , Yes, Sorry , have just added the pictures now.

all suggestions most welcome

bgengine gravatar imagebgengine ( 2020-07-29 09:34:33 -0600 )edit

1st thing to do - fix both camera & board, so you get exactly the same image roi

berak gravatar imageberak ( 2020-07-29 10:41:38 -0600 )edit

Appologies for the delay in getting back. I have now modified my first post to include images with Camera and board fixed. The capture angle might be slightly different between the images but there is nothing I could do about this.

Now that I have the correct images , can anyone help ?

bgengine gravatar imagebgengine ( 2020-08-06 05:05:06 -0600 )edit

anyone ? please ?

bgengine gravatar imagebgengine ( 2020-08-18 10:18:37 -0600 )edit