Car detection

asked 2014-03-18 19:31:16 -0600

chelo666 gravatar image

updated 2014-03-18 20:20:12 -0600

Recently I've been working on a program that allows you to detect when ever there's a parking space available. But my algorithm ran into a problem. I'm using simplecv and what I did was crop the parking as close as possible to the car and .meanColor() the crop and comparing that to a .meanColor() taken from and empty parking space. It was working fine with white and dark cars, but when I tried it with others colors that weren't so dark or light, the values were lower than the values of the empty space. I started looking for an alternative solution and stumbled upon the tutorial on car detection that simplecv provides, BUT it worked if you hardcoded the color. I don't want to hard code the color, I need to identify it or try something similar that can help me detect there's a car there.

This is what I tried :

from SimpleCV import *

imgOri = Image("allCars3.jpg")

imgOri = imgOri.scale(400, 400)

corX = 0  #ancho del parking

parking = 0

imgList = []

for i in range(3):

    imgList.append(imgOri.crop(corX, 70, 133, 120))

    avg = imgList[i].meanColor()


      if avg[0] < 123 and avg[1] < 126 and avg[2] < 127:

          parking += 1        

    corX += 133

imgList[2].show()

worked with these type of cars:

https://scontent-a-mia.xx.f... (picture too big to upload here)

Didn't work with these three:

https://scontent-a-mia.xx.f...

The values I took to detect a car where taken from this picture:

https://fbcdn-sphotos-c-a.a...

This is the tutorial I found for car detection:

http://tutorial.simplecv.or...

Notice that the person how wrote this tutorial already knew the color. I need the program to figure out that color in order to use that same idea.

Any suggestions, questions, tips or ideas are welcomed.

Thanks

edit retag flag offensive close merge delete