Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cropper.estimate_largest_interior_rectangle takes an eternity on Windows 11 #119

Open
Open
cropper.estimate_largest_interior_rectangle takes an eternity on Windows 11#119
Labels
faq contentthis topic or part of it could be moved into the faq sectionlirIssues regarding the largestinteriorrectangle functionality in the Cropper class

Description

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    faq contentthis topic or part of it could be moved into the faq sectionlirIssues regarding the largestinteriorrectangle functionality in the Cropper class

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions