Ask Your Question
0

How to detect the "external" pixels in an edge?

asked 2018-11-12 06:04:53 -0500

Filippo9669 gravatar image

Hi there. My goal using OpenCV is to detect airplanes (or anything else in the sky) and get the position of the object (at the moment it's being done for images and live camera stream in the next step). I have already succeeded in detecting edges, as shown below:

image description

To get the position of this (or any other) plane I thought of drawing a rectangle based on the most externally placed points:

image description

But I don't really know what's the best way of doing this. I could look for pixels with luminance greater than 0 and take only these with min and max x,y coordinates, but the drawback is that there could also happen to be objects which I don't want to detect. Have you got any idea that could help me? Thanks in advance!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2018-11-12 06:09:25 -0500

berak gravatar image

since you already have edges, you can detect contours and find their bounding boxes

edit flag offensive delete link more
0

answered 2018-11-14 13:45:21 -0500

Filippo9669 gravatar image

Another issue that has appeared - what if contour is not closed? The function

findContours(CANNY_IMAGE, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);

finds (divided) components of the actual contour and then the rectangle function assigns an adjusted rectangle to each of the components. The worse it gets when I have two objects to be identified on the image. What shall I do in the first case? Is there any function to make a continuous extrenal contour?

edit flag offensive delete link more

Comments

Well, I think I've almost helped myself - bluring a canny image seems to be quite a good way of improving the accuracy.

Filippo9669 gravatar imageFilippo9669 ( 2018-11-14 13:54:10 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-11-12 06:04:53 -0500

Seen: 43 times

Last updated: Nov 14