Posts

Showing posts from August, 2019

Detecting Lines Using OpenCV on ROS

Image
OpenCV is a widely used computer vision library. In order to perform ROS Perception, learning OpenCV is essential. OpenCV uses the BGR (Blue, Green, Red) format whereas ROS uses the RGB (Red, Blue, Green) format. In order to convert this image encoding, we use the Opencv_bridge. Once we have the image in BGR format, it's ready to be processed using OpenCV. The first step is to crop the image in order to work with the minimum size. Hence by doing this, we process only the part of the image that is important to us and discard away the unnecessary parts. The second step is to convert the cropped image to HSV format. HSV removes the image intensity which is very helpful in recognizing the same colors in different lights. Then we define the upper and the lower color boundaries in HSV format to detect a particular color. Say we want to detect yellow color : Lower : [20, 100, 100] Upper : [30, 255, 255] Once we have boundaries defined, we apply a mask on the image to get a binar...