I have this raw image in grayscale:
I would like to detect the edge of the object. However, it is affected by illumination near the edge. This is what I obtained after Gaussian blur and Canny edge detection:
This is my code:
cv::cvtColor(imgOriginal, imgGrayscale, CV_BGR2GRAY); // convert to grayscale
cv::GaussianBlur(crop, // input image
imgBlurred, // output image
cv::Size(5, 5), // smoothing window width and height in pixels
5); // sigma value, determines how much the image will be blurred
cv::Canny(imgBlurred, // input image
imgCanny, // output image
0, // low threshold
100); // high threshold
The light source is beneath the object. The illumination at the edge of object is from the light source or reflection of light. They are always at the same place.
The illumination is detected as edge as well. I have tried several other ways such as connected component labelling and binarize image with sample code (a beginner here) but to avail. Is there any way to detect clean edge illumination?