swig/python detected a memory leak of type 'int64 *', no destructor found.
Traceback (most recent call last):
File "DrawAHat.py", line 50, in <module>
VideoCapturePlayer(processFunction=drawHatOnFaces).main()
File "/usr/local/lib/python2.6/dist-packages/pycam/VideoCapturePlayer.py", line 160, in main
self.get_and_flip()
File "/usr/local/lib/python2.6/dist-packages/pycam/VideoCapturePlayer.py", line 126, in get_and_flip
res = self.processFunction(self.snapshot)
File "DrawAHat.py", line 36, in drawHatOnFaces
faces = pygameFaceDetect.getFaces(surf)
File "/usr/local/lib/python2.6/dist-packages/pycam/pygameFaceDetect.py", line 51, in getFaces
return faceDetect.detectObject(img)
File "/usr/local/lib/python2.6/dist-packages/pycam/objectDetect.py", line 130, in detectObject
t = cvGetTickCount() - t
TypeError: unsupported operand type(s) for -: 'SwigPyObject' and 'SwigPyObject'
swig/python detected a memory leak of type 'int64 *', no destructor found.
This afternoon, I jumped into these examples again and tried to figure out what the messages meant. But I know nothing about the swig/python lines. Then, I found out that I should step into objectDetect.py which is in charge of the detection of objects. The error messages said that the problems caused by something about types, and I found the cvGetTickCount() were used to get ticks for estimating fps, which is not crucial and can be isolated!
So I commented out the lines related to cvGetTickCount(), reinstalled the pycam library, and retried the DrawAHat.py example. It worked!
def detectObject(self,img):
"""
This should be pure opencv and reasonably quick.
It carrys out the actual detection, and returns a list of objects found
"""
# Could this go into init?
gray = cvCreateImage( cvSize(img.width,img.height), 8, 1 )
small_img = cvCreateImage( cvSize( cvRound (img.width/self.image_scale),
cvRound (img.height/self.image_scale)), 8, 1 )
cvCvtColor( img, gray, CV_BGR2GRAY )
cvResize( gray, small_img, CV_INTER_LINEAR )
cvEqualizeHist( small_img, small_img )
cvClearMemStorage( self.storage )
if( self.cascade ):
#t = cvGetTickCount()
objects = cvHaarDetectObjects( small_img, self.cascade, self.storage,
self.haar_scale, self.min_neighbors, self.haar_flags, self.min_size )
#t = cvGetTickCount() - t
#logging.debug( "%i objects found, detection time = %gms" % (objects.total,t/(cvGetTickFrequency()*1000.)) )
return objects
else:
logging.error("no cascade")
Here are two funny trials. Spider-Man and Guy Fawkes:
---
[1] These examples are located in ``pycam-read-only/pycam/examples/opencv''


No comments:
Post a Comment