Shift Rectangle up using Python?
Here's what I'm using to draw the rectangle
cv2.rectangle(img,(x,y), (x+w,y+h),(0,255,255),5)
I want to move the rectangle upward by some pixels. How do I do that?
Here's what I'm using to draw the rectangle
cv2.rectangle(img,(x,y), (x+w,y+h),(0,255,255),5)
I want to move the rectangle upward by some pixels. How do I do that?
the y axis points down in 2d opencv/numpy, so you need to subtract something, to make it go up:
y -= 5
cv2.rectangle(img,(x,y), (x+w,y+h),(0,255,255),5)
Asked: 2018-05-22 05:48:51 -0600
Seen: 1,106 times
Last updated: May 22 '18
Area of a single pixel object in OpenCV
Weird result while finding angle
cv2.perspectiveTransform() with Python
cv2 bindings incompatible with numpy.dstack function?
Getting single frames from video with python
Line detection and timestamps, video, Python
Different behaviour of OpenCV Python arguments in 32 and 64-bit systems