python - opencv: getPixel() not reflecting drawRectangle() -
when draw red square image, expect pixels in square 'red'. however, turn out black...
>>> simplecv import image,color >>> color.red (255, 0, 0) >>> i=image((100,100)) >>> i.drawrectangle(10,10,20,20,color.red,0,255) >>> i.getpixel(15,15) (0.0, 0.0, 0.0)
any ideas i'm doing wrong?
.... apparently, drawrectangle
call draws onto current drawing layer. after call applylayers()
, pixel more expected.
>>> simplecv import image,color >>> color.red (255, 0, 0) >>> i=image((100,100)) >>> i.drawrectangle(10,10,20,20,color.red,0,255) >>> i.getpixel(15,15) (0.0, 0.0, 0.0)
here goes:
>>> i=i.applylayers() >>> i.getpixel(15,15) (254.0, 0.0, 0.0)
Comments
Post a Comment