I have an image of a room below and I want to detect all wall edges. I've tried a lot of different combinations of filters (Bilateral, Gaussian, Laplacian, etc.) and the best combination seems to be the following,
The problem I have is that no matter what I've tried I can never get a distinct straight edge that runs across the wall adjacent to the ceiling. I've tried a number of techniques to try to darken the edge but to no avail. There is an app on the app store that detects this edge so I know it can be done, I'm just not sure what pre processing filters I need to apply, hope somebody can point me in the right direction.
cv::Mat edgeFrame;
cv::Mat grayImage;
cv::Mat blurFrame;
outputFrame=inputFrame.clone();
getGray(inputImage, grayImage);
cv::bilateralFilter(grayImage, blurFrame, 9,80, 80);
cv:Canny(blurFrame, edgeImage,100, 110,5);
cv::bilateralFilter(edgeImage, blurFrame, 21 , 80, 80);
cv::bilateralFilter(blurFrame, edgeImage,21, 100, 150);
int dilation_size =1;
Mat element = getStructuringElement( MORPH_ELLIPSE,
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
Point( dilation_size, dilation_size ) );
dilate( edgeImage, outputFrame, element );
The problem are the shadows in those edges, caused by the fact that illumination comes entirely from the sun through the window and there is no light source inside the room. Also the picture is relatively dark, so that its histogram will be concentrated on the lower side. Having said this, I would apply histogram equalisation as a first step to spread intensity over the whole range 0-255 and then, within canny apply a relatively large sigma (gauss blur) in order to suppress the high frequency edges.
Update: 1) greyvalue
2) histeq
3) canny
Indeed, while histeq increases contrast, it cannot help here, since in that region above the door the gradients are virtually zero, as you can see well from the second picture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With