Skip to content
Advertisement

Line detection issue – OpenCV in Python

I have written the following script with which I aim to detect lines in Gazebo (a simulation environment):

JavaScript

The code is integrated in ROS, so please focus your attention at the image_callback function. My issue is that the line that I want to detect is quite noisy and I cannot figure out how to detect it correctly.

To be more specific, from the following frame,

Original Frame

enter image description here

I get this image after gaussian blur and the canny algorithm,

Canny Frame

enter image description here

How could I filter the “noise” I see in the canny frame? I played a lot with the canny and gausian blur parameters but all that I have achieved is removing gradients instead of actually making it less “noisy”.

Advertisement

Answer

This method might help you to remove noise from the frame.

JavaScript

enter image description here

Advertisement