Visualizzazione post con etichetta openCV. Mostra tutti i post
Visualizzazione post con etichetta openCV. Mostra tutti i post

sabato 25 aprile 2009

Face detection with openCV python bindings

http://eclecti.cc/olpc/face-detection-on-the-olpc-xo

http://blog.jozilla.net/2008/06/27/fun-with-python-opencv-and-face-detection/

On the link above you can find the following code:

#!/usr/bin/python

# Face Detection using OpenCV. Based on sample code by Roman Stanchak
# Nirav Patel http://eclecti.cc 5/20/2008

import sys, os
from opencv.cv import *
from opencv.highgui import *

def detectObject(image):
grayscale = cvCreateImage(cvSize(640, 480), 8, 1)
cvCvtColor(image, grayscale, CV_BGR2GRAY)
storage = cvCreateMemStorage(0)
cvClearMemStorage(storage)
cvEqualizeHist(grayscale, grayscale)
cascade = cvLoadHaarClassifierCascade('haarcascade_frontalface_alt.xml',
cvSize(1,1))
faces = cvHaarDetectObjects(grayscale, cascade, storage, 1.2, 2,
CV_HAAR_DO_CANNY_PRUNING, cvSize(100,100))

if faces:
for i in faces:
cvRectangle(image, cvPoint( int(i.x), int(i.y)),
cvPoint(int(i.x+i.width), int(i.y+i.height)),
CV_RGB(0,255,0), 3, 8, 0)

def displayObject(image):
cvNamedWindow("face", 1)
cvShowImage("face", image)
cvWaitKey(0)
cvDestroyWindow("face")

def main():
# Uses xawtv. Gstreamer can be used instead, but I found it much slower
os.system("v4lctl snap jpeg 640x480 /tmp/face.jpg")
image = cvLoadImage("/tmp/face.jpg")
detectObject(image)
displayObject(image)
cvSaveImage("/tmp/face.jpg", image)

if __name__ == "__main__":
main()

Experimental funcionalities in openCV

http://www710.univ-lyon1.fr/~bouakaz/OpenCV-0.9.5/docs/ref/OpenCVRef_Experimental.htm#decl_cvFindStereoCorrespondence

On the link above some information about experimental openCV's functionalities in stereo-matching and object recognition.

OpenCV: Effort for 3D reconstruction

http://opencv.willowgarage.com/wiki/EffortFor3dReconstruction

On the link above, some documentation about openCV api's routines for 3D reconstructing processes.