Basic collision avoidance system using a Canny filter

asked 2018-05-18 03:23:45 -0500

updated 2018-05-18 04:09:28 -0500

I have developed a very basic yet effective collision avoidance system using contour detection (a Canny filter) and determining free and occupied space in a binary way processing frames retrieved from a monocular camera. Frames are first de-noised with a Gaussian filter and a subsequent erode/dilate to smooth the background reflections.
The outcome is a frame where the white areas represent free space and the black ones obstacles, colouring the frame in black once the first obstacle contour is detected.

Now I need to find the highest white point cluster and determine its relative position in the frame, as I mapped 10px=1° of relative heading.
However, I would like to exclude the noise-related extremely small peaks, less than a few pixels in width, so that the robot will choose a suitable course to steer.
Do you have any idea on how to do it?

A few images to clarify

This is the frame, specifically depicting the two legs of a table. The robot will turn right or proceed in the between if it fits.

image description

Here the example of a peak to be disregarded as due to noise

image description

edit retag flag offensive close merge delete


Not clear, are you using camera input or some sensor? Do you need to remove noise from normal 2D picture, or that narrow peaks from the presented examples?

ya_ocv_user gravatar imageya_ocv_user ( 2018-05-18 03:54:23 -0500 )edit

I explained a bit more. It's a monocular camera, the peaks are actually non-removable so the algorithm computing the highest point should simply disregard them.

Anelito gravatar imageAnelito ( 2018-05-18 04:10:15 -0500 )edit

If you want to remove small granular noise from the picture, the standard approach is to downsample the image, then upsample back. One moment... I will find an example.

ya_ocv_user gravatar imageya_ocv_user ( 2018-05-18 04:42:11 -0500 )edit

I have found the example, but looks like you already do de-noising. Then, where that peaks come from? Explain better how you create these images from the initial frames.

ya_ocv_user gravatar imageya_ocv_user ( 2018-05-18 05:02:08 -0500 )edit

wouldn't it be easier to simply cluster white areas and skip those whose width is less than say 5px?

Anelito gravatar imageAnelito ( 2018-05-18 05:31:29 -0500 )edit