-
-
Notifications
You must be signed in to change notification settings - Fork 203
Open
Labels
faq contentthis topic or part of it could be moved into the faq sectionthis topic or part of it could be moved into the faq sectionlirIssues regarding the largestinteriorrectangle functionality in the Cropper classIssues 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
Labels
faq contentthis topic or part of it could be moved into the faq sectionthis topic or part of it could be moved into the faq sectionlirIssues regarding the largestinteriorrectangle functionality in the Cropper classIssues regarding the largestinteriorrectangle functionality in the Cropper class