After converting the ROS images to OpenCV type, the detect_edges(cv::Mat) function will be called for finding the edges on the image, using the following inbuilt OpenCV functions:
cv::cvtColor( img, src_gray, CV_BGR2GRAY ); cv::blur( src_gray, detected_edges, cv::Size(3,3) ); cv::Canny( detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size );
Here, the cvtColor() function will convert an RGB image to a gray color space and cv::blur() will add blurring to the image. After that, using the Canny edge detector, we extract the edges of the image.