Hello everyone. I'm using OpenCV to find biggest rectangular object(paper sheet A4).
My work flow:
1. Apply filters(cvtColor/Canny/Blur)
2. via method **FindContours()** fill List with contours
3. loop List of contours(size)
4. Via **ApproxPolyDP**() method,fill ApproxCurve
5. If ApproxCurve.Cols() == 0 , then begin again recursively **step 1** with another filters.
So all works,but no so good,as i **except** and i need some advanced tips.
I have two types of filters,that i apply on source image:
Imgproc.cvtColor(SourceImage,SourceImage, Imgproc.COLOR_BGR2GRAY);
Imgproc.GaussianBlur(SourceImage, gray, new org.opencv.core.Size(5, 5), 0);
Imgproc.Canny(gray,gray, 75, 200);
after that,if my **approxCurves** == 0 or object is to small,i apply another filters:
Imgproc.cvtColor(SourceImage,SourceImage,Imgproc.COLOR_RGB2GRAY);
Imgproc.Canny(SourceImage, SourceImage,50,50);
Imgproc.GaussianBlur(SourceImage,gray,new Org.Opencv.Core.Size(5,5),5);
And that's it. For some "cases" it helps,but frequently fails. How can i improve my detection?
Thanks!
↧