Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

TypeError: slice indices must be integers

indeed, numpy /python3 is quite picky about it. if your values are float, you need to cast those manually, like:

x,y,w,h= [ int(corners[0][0]), int(corners[0][1]), int(s), int(s) ]
roi = image[y:y+h, x:x+w]

also, be careful here. if your y value is -1.06, it will silently be cropped to 0 !

TypeError: slice indices must be integers

indeed, numpy /python3 is quite picky about it. if your values are float, you need to cast those manually, like:

x,y,w,h= [ int(corners[0][0]), int(corners[0][1]), int(s), int(s) ]
roi = image[y:y+h, x:x+w]

also, be careful here. if your y value is -1.06, it will silently be cropped to 0 !! (while the c++ version wuld throw an exception)