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

cropper.estimate_largest_interior_rectangle takes an eternity on Windows 11 #119

Open
dfvr1994 opened this issue Aug 16, 2022 · 5 comments
Labels
faq content this topic or part of it could be moved into the faq section lir Issues regarding the largestinteriorrectangle functionality in the Cropper class

Comments

@dfvr1994
Copy link

Great work,

Perhaps cropper.estimate_largest_interior_rectangle could be computed much faster by:

# transform the panorama image to grayscale and threshold it 
gray = cv2.cvtColor(result, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY)[1]

# Finds contours from the binary image
cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)

# get the maximum contour area
c = max(cnts, key=cv2.contourArea)

# get a bbox from the contour area
(x, y, w, h) = cv2.boundingRect(c)

# crop the image to the bbox coordinates
result = result[y:y + h, x:x + w] 
@lukasalexanderweber
Copy link
Member

It runs an eternity since the functionality is compiled on the First Run. On the Second it should be REALY fast. I just need a way to inform the User that numba is compiling

@lukasalexanderweber
Copy link
Member

lukasalexanderweber commented Aug 16, 2022

And I will hava a Look on your approach, thanks!

@dfvr1994
Copy link
Author

dfvr1994 commented Aug 16, 2022

I left it running for like 8 hours and did not complete. Is there any problem with running it on Windows 11? Any way to compile manually?

@dfvr1994
Copy link
Author

Looks like the problem is on Windows. It run perfectly on Linux

@lukasalexanderweber
Copy link
Member

thanks for checking. I'm not able to reproduce since I'm running Windows 10

@lukasalexanderweber lukasalexanderweber transferred this issue from OpenStitching/stitching_tutorial Aug 1, 2023
@lukasalexanderweber lukasalexanderweber added the lir Issues regarding the largestinteriorrectangle functionality in the Cropper class label Aug 1, 2023
@lukasalexanderweber lukasalexanderweber changed the title cropper.estimate_largest_interior_rectangle takes an eternity cropper.estimate_largest_interior_rectangle takes an eternity on Windows 11 Aug 1, 2023
@lukasalexanderweber lukasalexanderweber added the faq content this topic or part of it could be moved into the faq section label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq content this topic or part of it could be moved into the faq section lir Issues regarding the largestinteriorrectangle functionality in the Cropper class
Projects
None yet
Development

No branches or pull requests

2 participants