-
Notifications
You must be signed in to change notification settings - Fork 393
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
BoundingBox: add area/volume attributes #375
Conversation
It feels weird multiplying area by time and having "volume" in a "Bounding Box", what is the bigger picture? |
Bounding boxes in TorchGeo have always been 3D boxes, I think volume makes sense here. We could also add an area attribute that only computes the spatial area. The context is that I'm planning on adding something like this to box1 = BoundingBox(*hit1.bounds)
box2 = BoundingBox(*hit2.bounds)
box3 = box1 & box2
if box3.volume > 0 or box1.volume * box2.volume == 0:
self.index.insert(i, tuple(box3))
i += 1 This is designed to help with #319. The idea is that an intersection dataset should only contain bounding boxes with zero volume if the original bounds also have zero volume (point data). This is for the case where we have two side-by-side bboxes and end up with 2 additional areas of intersection with 0 overlap. It might make more sense to use area though since |
Cool makes sense to me! This would provide the area attribute for #380 as well. |
Actually, this isn't true. |
Added an area attribute and clarified what we mean by "area" and "volume" in the docstrings. This should be good to go now. |
* BoundingBox: add volume attribute * Style fixes * BoundingBox: add area attribute
This PR adds area/volume attributes to the
BoundingBox
class.This is needed for a check I would like to add for #319, but I figured I would submit it as a separate PR to keep things easier to review.