main.cpp ( File view )

  • By nothan 2014-08-24
  • View(s):154
  • Download(s):0
  • Point(s): 1
			#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

#include <iostream>
#include <stdio.h>
 
using namespace std;
using namespace cv;
 
int main( )
{

    Mat image;
    image = imread("lena.jpg", CV_LOAD_IMAGE_COLOR); 
    namedWindow( "window1", 1 );   imshow( "window1", image );
 
    // Load Face cascade (.xml file)
    CascadeClassifier face_cascade;
    face_cascade.load( "C:/OpenCV231/data/Haarcascades/haarcascade_frontalface_alt2.xml" );
 
    // Detect faces
    std::vector<Rect> faces;
    face_cascade.detectMultiScale( image, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );
 
    // Draw circles on the detected faces
    for( int i = 0; i < faces.size(); i++ )
    {

        Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 );
        ellipse( image, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 255, 255 ), 4, 8, 0 );
    
}
     
    imshow( "Detected Face", image );
     
    waitKey(0);                  
    return 0;

}			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
cl.command.1.tlog798.00 B16-07-14 14:37
CL.read.1.tlog14.65 kB16-07-14 14:37
CL.write.1.tlog558.00 B16-07-14 14:37
face_new_jpg.exe.embed.manifest2.00 B16-07-14 14:37
face_new_jpg.exe.embed.manifest.res68.00 B16-07-14 14:37
face_new_jpg.lastbuildstate98.00 B16-07-14 14:37
face_new_jpg.log3.27 kB16-07-14 14:37
<face_new_jpg.unsuccessfulbuild>0.00 B16-07-14 14:37
<face_new_jpg.write.1.tlog>0.00 B16-07-14 14:37
face_new_jpg_manifest.rc214.00 B16-07-14 14:37
link.command.1.tlog2.00 B16-07-14 14:37
link.read.1.tlog2.00 B16-07-14 14:37
link.write.1.tlog2.00 B16-07-14 14:37
main.obj143.55 kB16-07-14 14:37
rc.command.1.tlog726.00 B16-07-14 14:37
rc.read.1.tlog458.00 B16-07-14 14:37
rc.write.1.tlog466.00 B16-07-14 14:37
vc100.idb379.00 kB16-07-14 14:37
vc100.pdb636.00 kB16-07-14 14:37
face_new_jpg.vcxproj8.07 kB16-07-14 14:37
face_new_jpg.vcxproj.filters953.00 B16-07-14 14:37
face_new_jpg.vcxproj.user143.00 B16-07-14 14:33
lena.jpg70.67 kB16-07-14 14:40
main.cpp1.09 kB21-07-14 12:14
cl.command.1.tlog784.00 B16-07-14 14:41
CL.read.1.tlog14.53 kB16-07-14 14:41
CL.write.1.tlog574.00 B16-07-14 14:41
face_new_jpg.exe.embed.manifest406.00 B16-07-14 14:37
face_new_jpg.exe.embed.manifest.res472.00 B16-07-14 14:37
face_new_jpg.exe.intermediate.manifest381.00 B16-07-14 14:41
face_new_jpg.lastbuildstate96.00 B16-07-14 14:41
face_new_jpg.log3.18 kB16-07-14 14:41
<face_new_jpg.write.1.tlog>0.00 B16-07-14 14:37
face_new_jpg_manifest.rc224.00 B16-07-14 14:37
link-cvtres.read.1.tlog2.00 B16-07-14 14:41
link-cvtres.write.1.tlog2.00 B16-07-14 14:41
link.14372-cvtres.read.1.tlog2.00 B16-07-14 14:41
link.14372-cvtres.write.1.tlog2.00 B16-07-14 14:41
link.14372.read.1.tlog2.00 B16-07-14 14:41
link.14372.write.1.tlog2.00 B16-07-14 14:41
link.command.1.tlog2.51 kB16-07-14 14:41
link.read.1.tlog5.01 kB16-07-14 14:41
link.write.1.tlog1.23 kB16-07-14 14:41
main.obj172.33 kB16-07-14 14:41
mt.command.1.tlog512.00 B16-07-14 14:41
mt.read.1.tlog502.00 B16-07-14 14:41
mt.write.1.tlog502.00 B16-07-14 14:41
rc.command.1.tlog766.00 B16-07-14 14:37
rc.read.1.tlog474.00 B16-07-14 14:37
rc.write.1.tlog482.00 B16-07-14 14:37
vc100.idb395.00 kB16-07-14 14:41
vc100.pdb644.00 kB16-07-14 14:41
face_new_jpg.sdf11.46 MB21-07-14 12:15
face_new_jpg.sln1.23 kB16-07-14 14:37
face_new_jpg.suo11.00 kB21-07-14 12:15
face_new_jpg-75f40f22.ipch46.00 MB21-07-14 12:14
face_new_jpg.exe59.50 kB16-07-14 14:41
face_new_jpg.ilk572.02 kB16-07-14 14:41
face_new_jpg.pdb1.11 MB16-07-14 14:41
<Debug>0.00 B16-07-14 15:53
<Debug>0.00 B16-07-14 15:53
<x64>0.00 B16-07-14 15:53
<face_new_jpg-9953f7d3>0.00 B21-07-14 12:14
<Debug>0.00 B16-07-14 15:53
<Debug>0.00 B16-07-14 14:37
<face_new_jpg>0.00 B16-07-14 15:53
<ipch>0.00 B21-07-14 12:11
<x64>0.00 B16-07-14 15:53
<face_new_jpg>0.00 B21-07-14 12:15
...
Sponsored links

main.cpp (9.98 MB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D