Ask Your Question

Problems with car detection example

asked 2014-05-11 01:52:13 -0500

memilanuk gravatar image

So... working through the book. Chapter 5 - same example as in the online tutorial here. Got a very different value for the mean color of the yellow car, so I went back through the example code, inserted some more comments, added some stuff to display (and then close out cleanly) the images at each stage.

from SimpleCV import Image
import time

# Load images.
car_in_lot = Image("parking-car.png")
car_not_in_lot = Image("parking-no-car.png")

# Crop image to region-of-interest.
car = car_in_lot.crop(470,200,200,200)

# Create greyscale image showing how far from yellow various colors are.
yellow_car = car.colorDistance(Color.YELLOW)

# Subtract greyscale image from cropped image to show just the yellow portions.
only_car = car - yellow_car

print only_car.meanColor()

which returns a result of (0.6376000000000001, 2.096775, 5.170425), instead of (25.604575, 18.880775, 4.4940750000000005) as given in both the book and tutorial.

The first image of the cropped parking spot with car looks fine... but the greyscale image is where things look decidedly odd. The image I get is rotated 90 degrees, and doesn't look at all like the one in the examples. I'd upload it, but the karma system here prevents it because I down-voted some spammer. Nice :/ Anyway, here's a link to it on Dropbox.

And from there... with the colorDistance so far off what it should be... the mean color values don't come out right.

Any ideas or suggestions as to why the colorDistance() step returned a funky rotated greyscale image like it did?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-06-25 03:55:09 -0500

oyvinaak gravatar image


I downloaded the superpack yesterday and had no problems. But today I uninstalled it and downloaded the "latest and greates" package and ran the example. No my image is flipped as well.

Don't know if this helps.


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-05-11 01:52:13 -0500

Seen: 331 times

Last updated: Jun 25 '14