我有这个图像,需要坐标头的起点和终点(直到颈部)。Opencv找到一个roi图像的坐标
我用下面的代码来裁剪图像,但得到下面的错误: -
import cv2
img = cv2.imread("/Users/pr/images/dog.jpg")
print img.shape
crop_img = img[400:500, 500:400] # Crop from x, y, w, h -> 100, 200, 300, 400
# NOTE: its img[y: y + h, x: x + w] and *not* img[x: x + w, y: y + h]
cv2.imshow("cropped", crop_img)
cv2.waitKey(0)
错误: -
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /Users/travis/build/skvark/opencv-python/opencv/modules/highgui/src/window.cpp, line 325
问题: -
- 如何找到坐标感兴趣区域的项目?
不应'x + w'大于'x'? – zindarod