When I draw a red square into an image, I expect the pixels in that square to be 'red'. However, they turn out to be black...
>>> from 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 what I'm doing wrong?
.... Apparently, the drawRectangle
call draws onto the current drawing layer. After a call to applyLayers()
, the pixel was more as expected.
>>> from 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)