Revision history [back]

I dunno why I can't reply to your answer, but I hope you see this. my code is:

while disp.isNotDone():
img2 = cam.getImage()

img_hsv=img2.toHSV()
imgBin = img_hsv.binarize(75).morphOpen().invert()
blobs = imgBin.findBlobs(minsize=30)
#blobs.draw(color=Color.PUCE, width=3)
count = 1
textLayer = DrawingLayer(img2.size())
textLayer.setLayerAlpha(75)
squares = blobs.filter([b.isSquare(0.1, 0.1) for b in blobs])
os.system('clear')
print squares.coordinates()
if squares:
textLayer.text(str(count), squares.coordinates(), color=Color.RED)
squares.draw(color=Color.PUCE, width=3)

count += 1
print len(squares)

img2.save(disp)


My problem here is trying to number all the squares according to their count. It seems using 'squares.coordinates()' for the location of the text is invalid here, but it seems to work if I'm using blobs.

I dunno why I can't reply to your answer, but I hope you see this. my code is:

while disp.isNotDone():
img2 = cam.getImage()

img_hsv=img2.toHSV()
imgBin = img_hsv.binarize(75).morphOpen().invert()
blobs = imgBin.findBlobs(minsize=30)
#blobs.draw(color=Color.PUCE, width=3)
count = 1
textLayer = DrawingLayer(img2.size())
textLayer.setLayerAlpha(75)
squares = blobs.filter([b.isSquare(0.1, 0.1) for b in blobs])
os.system('clear')
print squares.coordinates()
if squares:
textLayer.text(str(count), squares.coordinates(), color=Color.RED)
squares.draw(color=Color.PUCE, width=3)

count += 1
print len(squares)