Binary image matrix returns 0 values

asked 2013-12-13 05:48:53 -0500

anonymous user


Hello, i'm trying to create simple program that detects when the "red" color entered the field and makes a time stamp to .csv file when certain treshold of RED is crossed.

So far i have this:

from SimpleCV import *
cam = Camera()
while disp.isNotDone():
        capture = cam.getImage()  #capturing the image
        smaller = capture.scale(300, 300) #resize the image
        red = smaller.colorDistance(Color.RED)
        redbin=red.binarize(105) #when i binarize with this treshold i get almost ideal detection
        matrika = redbin.getNumpy() #trying to get 0 and 255 values
        print matrika  #want to see 0 and 255 values
        time.sleep(3) #repeating on 3 seconds

So basically since this treshold for binarize works great in my conditions, my plan was to: 1. get the matrix with 0 and 255 values 2. Count the number of 255 values and figure out "secondary treshold" 3. Write further code which timestamps in .csv file each time secondary treshold is met

Problem is, when i print "matrika" i get only 0 values, even though i can see clearly from "" that some of the values should be white.

I started with SimpleCV&Python yesterday so sorry for clumsy code.

edit retag flag offensive close merge delete


Where is rdecabin defined? Have you looked at a histogram or sum of your matrika values?

mechiris gravatar imagemechiris ( 2013-12-30 18:14:59 -0500 )edit