I am new to OpenCV with Android. I am currently working on document detection demo app. What I did so far is as below:
Original image -> Gray scale image -> GaussianBlur -> Canny edge detection -> finding contours -> draw Contours
I am able to detect paper sheet perfectly as you can see in below image .
But it does not detect some documents. Below is one of them
I researched a lot about that and found that the problem lies in canny edge detection and below is the canny image :
As you can see , the edge detection is not perfectly linked and it does not connect edges at some point. That is the reason for that .
I have gone through the similar issue at : How to select the best set of parameters in Canny Edge detection algorithm implemented in OpenCV? I have followed the solution but it didn't worked for me.
My canny detection code is as follow :
double otsu_thresold = Imgproc.threshold(mGray,edged,0,255, Imgproc.THRESH_OTSU);
Imgproc.Canny(mRgba, edged, otsu_thresold*0.5,otsu_thresold);
I don't know where I am wrong! What should I do to perfectly detect the document?