iRove108 / markups

Locate marked-up regions in photos of books and documents using Python and OpenCV.
MIT License
0 stars 4 forks source link

Test out other highlighting colors #3

Open iRove108 opened 4 years ago

iRove108 commented 4 years ago

Main.py for the highlight extraction example uses the default lower and upper HSV bounds, as specified in highlighting.py. These bounds have been fine-tuned for a standard yellow highlighter. This is why the example works well on this image. However, it may be possible to get the code to work for different colors as well. After installing the package as described in the README:

  1. Find an image of text highlighted in a color other than the standard yellow (e.g. green). If you own highlighters, do some highlighting and take a picture.
    • Place that image in the highlighted_text directory, naming it something like image_green_highlight.jpg
  2. Duplicate main.py and call it something like main_green_highlight.py
  3. Edit the script to open your new image instead of image.jpg (relevant line)
  4. Use the a color picker like this one to find the lower/upper bounds you would like to set to extract your new highlight color.
  5. Test it out! See if you can fine tune your original lower/upper bound arrays to improve the extraction

It's okay if this doesn't work perfectly! It might not—I've only tested the code with yellow highlighting colors. Nonetheless, you can still create the PR to demonstrate how well the library does/doesn't work for other colors.

saidaibrg commented 4 years ago

Hi Alex, I like your idea for the library! I tried testing out your code for green highlights. I was a bit confused about how to test and run the code, so here're some suggestions about this issue to help future contributors:

iRove108 commented 3 years ago

The library should install OpenCV when it is installed with pip. Additionally, for others having the same problem as the previous poster mentioned in their third bullet, please see this issue.