Examples of CvSeq


Examples of com.googlecode.javacv.cpp.opencv_core.CvSeq

                chooseXmlDetectionFile();
            }
           
            int detectionCount = 0;
           
            CvSeq faces = null;

            while (canvasFrame.isVisible() && (frame = grabber.grab()) != null) {
                cvSmooth(frame, frame, CV_GAUSSIAN, 9, 9, 2, 2);
               
                detectionCount++;
                if (detectionCount > 5) {
                    detectionCount=0;
                    IplImage grayImage = null;
                    try {
                        grayImage = IplImage.create(frame.width(),
                                frame.height(), IPL_DEPTH_8U, 1);
                    } catch (NullPointerException e) {
                        System.out.println("Error: " + e);
                        System.out.println("Check image file!");
                        System.exit(1);
                    }
                    // We convert the original image to grayscale. 
                    cvCvtColor(frame, grayImage, CV_BGR2GRAY);


                    // We instantiate a classifier cascade to be used for detection, using 
                    // the cascade definition. 
                    CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(
                            cvLoad(detectionXmlFile));

                    // We detectionExecute the faces. 
                    faces = cvHaarDetectObjects(grayImage, cascade, storage, 1.1, 1,
                            0);

                }
                if (faces!=null) {
                    // We iterate over the discovered faces and draw yellow rectangles 
                    // around them.
                    for (int i = 0; i < faces.total(); i++) {
                        CvRect r = new CvRect(cvGetSeqElem(faces, i));
                        cvRectangle(frame, cvPoint(r.x(), r.y()),
                                cvPoint(r.x() + r.width(), r.y() + r.height()),
                                CvScalar.YELLOW, 1, CV_AA, 0);
                       
View Full Code Here

Examples of com.googlecode.javacv.cpp.opencv_core.CvSeq

        // the cascade definition. 
        CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(
                cvLoad(cascadeFileName));

        // We detectionExecute the faces. 
        CvSeq faces = cvHaarDetectObjects(grayImage, cascade, storage, 1.1, 1,
                0);

        // We iterate over the discovered faces and draw yellow rectangles 
        // around them. 
        for (int i = 0; i < faces.total(); i++) {
            CvRect r = new CvRect(cvGetSeqElem(faces, i));
            cvRectangle(originalImage, cvPoint(r.x(), r.y()),
                    cvPoint(r.x() + r.width(), r.y() + r.height()),
                    CvScalar.YELLOW, 1, CV_AA, 0);

        }

        ImageIcon image = new ImageIcon(originalImage.getBufferedImage().getScaledInstance(-1, -1, 0));
        // ImageIcon.getImage() will make sure all bytes are loaded
        image.getImage();
        setDetectionResult(faces.total());
        return image;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.