-
Notifications
You must be signed in to change notification settings - Fork 0
/
trackball3.py
33 lines (21 loc) · 928 Bytes
/
trackball3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: cp1252 -*-
import SimpleCV
from SimpleCV import Image
display = SimpleCV.Display()
img = Image("ping/source/image3.jpeg")
# parametre pour image1 : (dilate=2), (stretch(200,255), isCircle(0.2)
# parametre pour image2 : non trouvé
# parametre pour image3 : (dilate=2), (stretch(2,120), isCircle(0.2)
# parametre pour image4 : (dilate=2), (stretch(2,120), isCircle(0.2)
# parametre pour image5 : (dilate=2), (stretch(2,120), isCircle(0.2)
# parametre pour image6 : plante
# parametre pour image7 : non trouvé
dist = img.colorDistance(SimpleCV.Color.ORANGE).dilate(2)
segmented = dist.stretch(2,120).invert()
blobs = segmented.findBlobs()
if blobs:
balles = blobs.filter([b.isCircle(0.2) for b in blobs])
if balles:
for balle in balles:
img.drawCircle((balle.x,balle.y),balle.radius(),SimpleCV.Color.BLUE,3 )
img.show()