python - OpenCV cv2.rectangle output binary image -
i have been trying draw rectangle on black image, uscv2.rectangle
.here code : (it sample, in actual code there loop i.e values x2,y2,w2,h2 changes in loop)
heir = np.zeros((np.shape(image1)[0],np.shape(image1)[1]),np.uint8); cv2.rectangle(heir,(x2,y2),(x2+w2,y2+h2),(255,255,0),5) cv2.imshow("img",heir); cv2.waitkey()
it giving following output: why image that? why boundaries not line width 5. have tried, not able figure out.
can't post in comment, it's negative answer: same operations work me on windows/python 2.7.8/opencv3.1
import numpy np import cv2 heir = np.zeros((100,200),np.uint8); x2=10 y2=20 w2=30 h2=40 cv2.rectangle(heir,(x2,y2),(x2+w2,y2+h2),(255,255,0),5) cv2.imshow("img",heir); cv2.waitkey()
Comments
Post a Comment