Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can do this with <a href="http://opencv.itseez.com/modules/imgproc/doc/miscellaneous_transformations.html?cv2.threshold#threshold" rel="noreferrer">threshold</a>, <a href="http://opencv.itseez.com/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=findcontour#void%20findContours%28InputOutputArray%20image,%20OutputArrayOfArrays%20contours,%20OutputArray%20hierarchy,%20int%20mode,%20int%20method,%20Point%20offset%29" rel="noreferrer">findContours</a>, and <a href="http://opencv.itseez.com/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=findcontour#boundingrect" rel="noreferrer">boundingRect</a>.</p> <p>So, here is a quick script doing this with the python interface.</p> <pre><code>stitched = cv2.imread('stitched.jpg', 0) (_, mask) = cv2.threshold(stitched, 1.0, 255.0, cv2.THRESH_BINARY); # findContours destroys input temp = mask.copy() (contours, _) = cv2.findContours(temp, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # sort contours by largest first (if there are more than one) contours = sorted(contours, key=lambda contour:len(contour), reverse=True) roi = cv2.boundingRect(contours[0]) # use the roi to select into the original 'stitched' image stitched[roi[1]:roi[3], roi[0]:roi[2]] </code></pre> <p>Ends up looking like this: <img src="https://i.stack.imgur.com/aGccT.png" alt="enter image description here"></p> <p><strong>NOTE :</strong> Sorting may not be necessary with raw imagery, but using the compressed image caused some compression artifacts to show up when using a low threshold, so that is why I post-processed with sorting.</p> <p>Hope that helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload