Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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?

click to hide/show revision 2
retagged

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

berak gravatar image

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

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?