Ask Your Question
0

Detect if contour is simple curve without complex pattern or detect starting and ending points of contour

asked 2014-10-26 10:05:50 -0600

enkor gravatar image

I have a problem with detecting if contour is a simple curve or line. I need to filter as many object as I can and leave only interesting objects for me. But it's not a goal to filter all unwanted objects. I have more logic to detecting required objects later but it cost a lot of time. So I'm looking for some low cost solution for filtering unwanted object before main algorithm take the part.

I have two examples from my application.

image description

image description

So I want to remove the yellow marked objects. And leave the green marked object. I don't circle everything, because they are so many :]. My idea was that if I can detect if the line is starting and ending in the corners of bounding box, but I dont'k know how can I detect where the line starts and ends. Or If I'm able to detect starting and ending points of contour I can decide it by their distance.

I use canny edge detection and find contours. And I have some basic filtering of object depending on their size.

I'm out of ideas and stuck at this part. I will be glad for your help or ideas.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-26 12:17:08 -0600

you can try to find the lines using HoughLinesP for each red box, and if the detector find lines, you can mark this connected component as "bad"...

edit flag offensive delete link more

Comments

1

The yellow box only contains one line each so that I'd just use fitLine and compute the mean or max distance to the line for each point and put a threshold on it.

FooBar gravatar imageFooBar ( 2014-10-26 14:00:48 -0600 )edit

HoughLinesP do the job. Thank you.

enkor gravatar imageenkor ( 2014-10-29 14:57:01 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-10-26 10:05:50 -0600

Seen: 1,487 times

Last updated: Oct 26 '14