Ask Your Question
0

Shift Rectangle up using Python?

asked 2018-05-22 05:48:51 -0600

Philia gravatar image

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-05-22 06:13:39 -0600

berak gravatar image

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)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-05-22 05:48:51 -0600

Seen: 1,042 times

Last updated: May 22 '18