-
Notifications
You must be signed in to change notification settings - Fork 6
/
blob-car-detect.py
46 lines (34 loc) · 983 Bytes
/
blob-car-detect.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from SimpleCV import *
import sys
if len(sys.argv) > 1:
image_string = sys.argv[1]
else:
image_string = "positive_images/screenshot_11-23_17:00"
car = Image(image_string)
no_car = Image("negative_images/screenshot_11-24_17:00")
# crop with full car & no back wall:
car = car.crop(170, 170, 230, 300)
no_car = no_car.crop(170, 170, 230, 300)
blobs = car.findBlobs(minsize=400, maxsize=100000)
for blob in blobs:
blob.drawMinRect(color = Color.RED, width = 2)
car.show()
raw_input()
blobs = no_car.findBlobs(minsize=400, maxsize=100000)
for blob in blobs:
blob.drawMinRect(color = Color.RED, width = 2)
no_car.show()
raw_input()
#biggestArea = 0
#for blob in blobs:
# if blob.area() > biggestArea:
# biggestArea = blob.area()
# biggestBlob = blob
#
#lowestPoint = 0
#for points in biggestBlob.minRect():
# if points[1] > lowestPoint:
# lowestPoint = points[1]
#
#print "Image " + image_string + " has " + str(lowestPoint) + " lowest point"
#raw_input()