Ask Your Question
0

Edge/Contour identification

asked 2018-03-20 06:44:40 -0600

AP108 gravatar image

Hello,

Let's say we have one original/ prototype image and one for testing as below. image description

image description

And I want each time to test if each of the horizontal lines in the second image are the same with the analogous in the original image. The problem is that in the test image there may be noise etc and the length of each line may not be the same (that's what we want to check!).

To sum up, after finding the contours of 2 images, how can I compare contours which are suposed to be on the same place but may have not the same index because of noise.... Is there any kind of labelling that will allow me to do that automatically (for many test images)?

Thanks in advance

edit retag flag offensive close merge delete

Comments

I have thought of using some kind of masks which would let only one horizontal line per time to check, but I am not quite sure how to do it automatically and without affecting the test image....

AP108 gravatar imageAP108 ( 2018-03-20 12:41:46 -0600 )edit

I would say comparing contours is unnecessary here! You can find Lines in the Two Images and compare its x,y Co-Ordinates in the two Images!

Balaji R gravatar imageBalaji R ( 2018-03-20 23:05:34 -0600 )edit

I don't know.. The lines may be broken or of uneven breadth, so something like hough lines may not be suitable. So, my major problem here is to label the lines and then compare them between the two pictures... Thanks anyway..

AP108 gravatar imageAP108 ( 2018-03-22 07:58:54 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-03-20 10:52:17 -0600

Simonn gravatar image

If you already have the contours of the lines you want the measure you could use cv2.boundingRect(cnt) to draw a box around the contours. The third value this function returns is the width of this box. (Which should be equal to the width of your line)

Was this what you wanted to know?

edit flag offensive delete link more

Comments

First of all, thanks for your reply. Yes, I already have the contours but the problem is that the images donnot have the same numbers of contours. So, if I want to check the first line, let's say i would take the 1st contour from the first picture and the (what?) contour of the second??? I don't want to do it 'manually', namely in every case find what number contour in the first image corresponds to the second. I want to do it automatically for many test images.....

AP108 gravatar imageAP108 ( 2018-03-20 12:37:36 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-03-20 06:44:40 -0600

Seen: 384 times

Last updated: Mar 20 '18