detecting multi color document with OpenCV4Android

asked 2017-07-17 04:04:44 -0600

I am new to OpenCv with Android.I am trying to make an application which auto detects documents using OpenCv - 2.4.13 . In my app, there is a functionality of detection documents (like a Scanbot app) and then prospect it to document. So, far I am able to detect documents with single colour or documents which are clearly distinguishable from background. But the problem arises when the document is of multi-color. To clearly understand the problem , I have attached an image:

image description

I am new to OpenCv with Android.I am trying to make an application which auto detects documents using OpenCv - 2.4.13 . In my app, there is a functionality of detection documents (like a Scanbot app) and then prospect it to document. So, far I am able to detect documents with single colour or documents which are clearly distinguishable from background. But the problem arises when the document is of multi-color. To clearly understand the problem , I have attached an image:

enter image description here

As you can see, the blue line is a detection line and it is not detecting full document. What i did so far is as below :

original image -> cvtColor -> GaussianBlur filter -> dilate it to sharpen edges -> applied watershed image segmentation algorithm -> canny edge detection with dynamic otsu's threshold -> then find largest contours -> draw contours

After some research, I came to know that the problem rely on canny edge detection. Below is the result I get after canny edge detection:

image description

Is there any way to achieve this? Any help will be highly appreciated !! Thanks in advance

edit retag flag offensive close merge delete