Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Enhanced Rectangle/Document detection in android #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

humphreyja
Copy link
Member

@humphreyja humphreyja commented Mar 15, 2020

This is an attempt to address issue #29.

This branch is meant to experiment with a different algorithm to find the best rectangle in the image.

Things being tried:

  1. Function that filters and finds the largest/best looking rectangle. UPDATE: Not very effective
  2. Enhancing the filter before attempting to find the edges (brightening the image if it's too dark, etc). UPDATE: This is showing some promising returns
  3. Updating OpenCV.

Filtering issue:
So far, I'm not really liking the solutions. We need to have some sort of check to make sure the ratio isn't too far out of line, as well as something that makes sure it is large enough.

Another thing I will be looking into is the transforms on the image before the contours are found. This may be what is causing issues where the rectangle is just not detected at all.

@humphreyja humphreyja added android Android Problem or Feature Currently Working On labels Mar 15, 2020
@humphreyja
Copy link
Member Author

Latest update. I experimented with changing the alpha and beta channels of the image (gain and brightness) based off of the brightness of the image. This allows for better fitting/high contrast images which makes the edges pop a lot better. In terms of finding rectangles, it looks like it made the android simulator much better at detecting, but maybe no change on my android phone (it's ancient LG G3, so it could be just a weird thing with that). I have one more trick up my sleeve, and that would be to update OpenCV. Maybe it's gotten smarter?

Here's an image (after applying high contrast filters) with a fake receipt that OpenCV is having difficulty finding the receipt/rectangle in. Again, this is on a really old phone, so that could be the issue too.

Cfd41bcc7-808c-49f1-8ff4-fb94dacb9584

@humphreyja humphreyja changed the title Look for largest rectangle not just first rectangle Enhanced Rectangle/Document detection in android Mar 23, 2020
@ScreamZ
Copy link

ScreamZ commented Sep 26, 2020

Any news on this ?

@vsyw
Copy link

vsyw commented Jul 16, 2021

@humphreyja as you mentioned in the thread regarding upgrading openCV, could you give us a hint about how to upgrade openCV for this project?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
android Android Problem or Feature Currently Working On
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants