CV2.rectangle expects integer on windows but works with float on Ubuntu

asked 2018-07-29 20:32:48 -0500

jarulsamy gravatar image

updated 2018-07-29 23:44:27 -0500

berak gravatar image

I was working on some code on ubuntu and tried to run it on windows.

I get this error on Windows: TypeError: integer argument expected, got float

self.rect1 = [(self.width / 2) - 10, (self.height / 2) - 10]

self.rect2 = [(self.width / 2) + 10, (self.height / 2) + 10]

cv2.rectangle(self.image, tuple(self.rect1), tuple(self.rect2), (255,0,0), -1)

I understand I can solve this by using int() but I would like to use the floating values as I did on Ubuntu.

Is there a reason this is OS specific?

edit retag flag offensive close merge delete