While trying to track objects in real time using opencv, I came across a demo of "find object" for pyopencv . This script does what I want, except that it compares one static image with another, while I am trying to compare a static image with the current frame captured from a webcam. To this end, I replaced this line
scene_filename = "box_in_scene.png"
with this
capture = cv.VideoCapture(0) frame = Mat() capture >> frame imwrite("box_in_scene.png",frame)
This works as it should, but when I try to add a simple loop to get it to do this continuously, it goes through one loop and then stops. When I exit the script, I get the following error:
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupport ed array type) in cvGetMat, file M:\programming\packages\opencv\workspace\2.1\Op enCV-2.1.0\src\cxcore\cxarray.cpp, line 2476 Traceback (most recent call last): File "find_obj.py", line 114, in <module> imageDescriptors = surf(image, mask, imageKeypoints) RuntimeError: M:\programming\packages\opencv\workspace\2.1\OpenCV-2.1.0\src\cxco re\cxarray.cpp:2476: error: (-206) Unrecognized or unsupported array type in fun ction cvGetMat
Does anyone know what might cause this?
The cycle that I use
myloop = 1 while myloop == 1 :
This link is the whole code.
source share