Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if (bbox_intersection_area(ba, bb) / bbox_area(ba)) > 0.8: ZeroDivisionError: float division by zero #495

Open
arjungandeeva opened this issue Apr 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@arjungandeeva
Copy link

I'm encountering a ZeroDivisionError: float division by zero error in camelot-py when using the functions bbox_intersection_area and bbox_area. This error occurs under certain conditions, likely when the bounding box area (ba) is zero.

@arjungandeeva arjungandeeva added the bug Something isn't working label Apr 4, 2024
@cktse
Copy link

cktse commented Apr 10, 2024

I did a quick fix/hack to circumvent the error by skipping over the area check if ba is singular (area is zero):

~/.pyenv/versions/3.11.3/lib/python3.11/site-packages/camelot/utils.py: Line 375:

            if bbox_area(ba) > 0 and bbox_intersect(ba, bb):
                # if the intersection is larger than 80% of ba's size, we keep the longest
                if (bbox_intersection_area(ba, bb) / bbox_area(ba)) > 0.8:
                    if bbox_longer(bb, ba):
                        rest.discard(ba)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants