question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bounding box coordinates for Trim

See original GitHub issue

Is your feature request related to a problem? Please describe

I have a binary image with black background and white object. I need a high performance method to extract the bounding box for the white object. It is acceptable for bounding box to always be parallel to the edges.

I tried MinimumBoundingBox(), but it is too slow due to Rotating Calipers algorithm to recover angled bounding boxes (which I anyway grow to edge parallel bounding box).

I tried using Trim() which is performant, but it doesn’t provide the bounding box coordinates. On the command line there is a way to get Trim to return the bounding box info.

Describe the solution you’d like

A fast edge parallel minimum bounding box method. Alternatively, a version of Trim() to return bounding box coordinates relative to original image.

Describe alternatives you’ve considered

MinimumBoundingBox and Trim

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Sep 13, 2021

Thanks for reporting this. The problem is that in your example a warning is raised but the native code is not getting a pointer due to a bug in Magick.NET. This warning is raised because the bounding box is 0x0. This will return null in the next release of Magick.NET instead.

0reactions
saikatguhacommented, Sep 15, 2021

Works great. Thanks for the super quick resolution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How would I trim a bounding box?
1 Answer. Since you are using the [H] float placement (supplied by float ), it isn't actually a float. So you can just...
Read more >
Trim Bounding Box Center
Gives you the details of how many pixels would be trimmed horizontally and vertically if you were to use trim, this is great...
Read more >
Calculate Bounding box coordinates from a rotated rectangle
I have the coordinates of the top left point of a rectangle as well as its width, height and rotation from 0 to...
Read more >
Block trim and bounding box
Block trim and bounding box. ... I want to update a block trim lisp from MelFranks. ... (vlax-get-property(eval x)'Coordinates)
Read more >
BoundingBox | Rhino 3-D modeling
The BoundingBox command creates a rectilinear box object (polyline or polysurface) that encloses selected objects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found