擅长:python、mysql、java
<p>我找到了一种使用openCV3和python3.6实现的方法</p>
<pre><code>image_neg = cv2.bitwise_not(image) # invert the root to white
coords = cv2.findNonZero(image_neg) # find all the non-zero points (root)
x, y, w, h = cv2.boundingRect(coords) # find minimum spanning bounding box
rect = image[y:y+h, x:x+w]
</code></pre>