0

I am trying to create a face detection program using python 2.7.3 and opencv 2.4.3. I have been looking at a lot of code online, and I always see two lines of code that create storage after creating an image, and then the storage is cleared. Why it is necessary to create storage and then clear it?

Here is an example:

storage = cvCreateMemStorage(0)
cvClearMemStorage(storage)

Here is one of the links I am referencing: https://geekwentfreak-raviteja.rhcloud.com/2011/02/faceeyehand-detection-using-opencv-python-binding/

Thanks for any help!

JustBlossom
  • 1,259
  • 3
  • 24
  • 53

1 Answers1

1

the code you're refering to is using the outdated c api, and the old cv wrapper. please don't use that !

prefer the newer cv2 api (together with numpy), the old one will go away in near future.

https://github.com/Itseez/opencv/blob/2.4/samples/python2/facedetect.py

berak
  • 39,159
  • 9
  • 91
  • 89
  • Thanks, that is good to know. I was kind of confused about that as well. I have seen a lot of variations of code using cv and cv2. Just as a not, an import error is coming up in the code. Does that just have to do with my version of python as well? – JustBlossom Aug 15 '13 at 19:11
  • * "Just as a not, an import error is coming up in the code." what kind of import error ? (did not understand) * "Does that just have to do with my version of python as well ?" probably not. cv2 should work with python26 upwards – berak Aug 15 '13 at 19:16
  • Sorry, I meant *note*. Here is the error- I did not change anything. Traceback (most recent call last): File "directory", line 6, in from video import create_capture ImportError: No module named video – JustBlossom Aug 15 '13 at 19:26
  • there's no video module in cv2. did you want [cv2.VideoCapture](http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#cv2.VideoCapture) ? – berak Aug 15 '13 at 19:38
  • It is saying that "from video import create_capture" is not valid. Therefore, I cannot capture video. – JustBlossom Aug 15 '13 at 19:41