Error for boundBox() and drawBB()

asked 2013-04-14 08:38:28 -0500

FunnyFunk91 gravatar image

I am currently writing a detection/tracking system for cars in a car park. I have gotten some great help from @jayrambhia. The only problem I am having now is that I cannot use the method boundBox() or drawBB(). Anytime I run the code I get the following errors.

Traceback (most recent call last):
   File "C:/Users/Chris/Desktop/SimpleCVScripts/detectionTwo.py", line 18, in    <module>
   car_blob_bounding_box = car_blobs.boundingBox()
AttributeError: 'FeatureSet' object has no attribute 'boundingBox'

And I get the following error for drawBB()

Traceback (most recent call last):
 File "C:/Users/Chris/Desktop/SimpleCVScripts/detectionTwo.py", line 24, in <module>
tracking_list.drawBB(color = scv.Color.RED)
AttributeError: 'list' object has no attribute 'drawBB'

I don't know what's causing this. I can't tell if the code I have written is going to work unless I test it. Is there anything in the code below that could be causing these errors?.

 import numpy
 import cv2 as cv
 import SimpleCV as scv
 from datetime import datetime

 background_subtraction = cv.BackgroundSubtractorMOG(24*60, 3, 0.9, 0.01)
 capture = cv.VideoCapture(0)

'''
#Not used until detection/tracking is working
number_of_cars = 0;
'''

#Clean up the image
def preproccessor():

display_image.dilate(2)
display_image.erode(2)

#Remove the background from the image
def subtract_background():

    global f, image
    global fgmask
    global display_image

    f, image = capture.read()
    fgmask = background_subtraction.apply(image)
    display_image = scv.Image(image)
    preproccessor()

#Detect blobs in the image
def detect_cars():

    global cars

    cars = display_image.findBlobs()

    if cars:
        cars.draw()

#Track the blobs that were detected
def track_cars():

    tracking_list = []
    car_bounding_box = cars.boundingBox()
    tracking_list = image.track("mftrack",ts,display_image,cbox)
    tracking_list.drawBB()
    display_image.show()

#Main loop for the program
while(True):
    subtract_background()
    detect_cars()
    track_cars()
edit retag flag offensive close merge delete

Comments

jayrambhia gravatar imagejayrambhia ( 2013-04-14 14:38:02 -0500 )edit