Giter Site home page Giter Site logo

Comments (2)

karolzak avatar karolzak commented on August 16, 2024

Hi @martinkozle !
Thanks for sharing your issue.
Looking back I agree that putting that hardcoded (1,1) value for group_size_range wasn't the best practice but I can definitely share some of the logic behind it:

  • The grouping params and logic is used for cases where you want to detect character boxes on forms and group them such as here:

image

  • For get_checkboxes pipeline I used group_size_range = (1,1) to completely avoid grouping and treat every detection as a separate entity of a checkbox instance
  • In my work I haven't seen an example where it would be useful to actually group checkbox detections
  • If current pipeline configuration for detecting checkboxes fails to detect some checkboxes on your input data, maybe you could share such example and I could investigate what is the problem there?

Let me know if that helps in anyway!

from boxdetect.

martinkozle avatar martinkozle commented on August 16, 2024

I can't really send the real images that I was working with. So I tried recreating the issue with an image I found on the internet:
renditionDownload

With these options:

cfg = config.PipelinesConfig()

# important to adjust these values to match the size of boxes on your image
cfg.width_range = [(10, 50)]
cfg.height_range = [(10, 50)]

# the more scaling factors the more accurate the results but also it takes more time to processing
# too small scaling factor may cause false positives
# too big scaling factor will take a lot of processing time
cfg.scaling_factors = [0.7, 0.9, 1.0, 1.2, 1.5, 2.0]

# w/h ratio range for boxes/rectangles filtering
cfg.wh_ratio_range = [(0.9, 1.1)]

# num of iterations when running dilation tranformation (to engance the image)
cfg.dilation_iterations = [0]

checkboxes = get_checkboxes(img, cfg=cfg, px_threshold=0.1, verbose=True)

img_vis = img.copy()
for (x, y, w, h), _, _ in checkboxes:
    img_vis = cv2.rectangle(img_vis, (x, y), (x+w, y+h), (0, 255, 0), thickness=3)

It found 0 checkboxes.

By setting only vertical max distance:

cfg.vertical_max_distance = [0]

I get a couple of checkboxes detected:
tmp6zetij1h

By setting only horizontal max distance:

cfg.horizontal_max_distance = [0]

I get all checkboxes detected:
tmp8lumh8rn

And by setting both options I also get all checkboxes detected

This is why I was confused with the grouping regarding checkboxes.

Unrelated to this, on my data the checked checkboxes had big checks and X marks that extended far outside the checkboxes that made the square contours approach not really work. So in the end I made my own solution from scratch that only uses kernels and filter2D to find checkboxes that works well in my case (not a general solution).

Thank you for your help. I hope that you can also reproduce the same issue and that it helps in improving the library.

from boxdetect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.