Comments (3)
Since you are running a 32-bit x86 implementation of Java, have you tried to
recompile OpenCV without SSE instructions as indicated in the README.txt file?
Original comment by [email protected]
on 25 Aug 2010 at 12:44
from javacv.
Closing this long-standing issue, assuming that recompiling OpenCV without SSE
instructions did the trick. Please reopen the issue if that is not the case,
thank you.
Original comment by [email protected]
on 4 Nov 2010 at 10:35
- Changed state: Done
from javacv.
Hi I am trying to use JavaCv to detect faces and then wanted to store those
faces in jpg format. I got success in face detection using readme file with
javacv. but while saving I faced problems. Following is the code ... I tried to
use cvSave but it do not store it in correct format.Please guide where i am
wrong . Thank you in advance
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package facedetect;
/**
*
* @author User
*/
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.*;
import com.googlecode.javacv.cpp.*;
import java.awt.Image;
import java.nio.Buffer;
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_calib3d.*;
import static com.googlecode.javacv.cpp.opencv_objdetect.*;
public class Demo {
public Buffer buf = null;
public static void main(String[] args) throws Exception {
String classifierName = "C:\\haarclass\\haarcascade_frontalface_alt.xml";
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
CvHaarClassifierCascade classifier = new CvHaarClassifierCascade(cvLoad("C:\\haarclass\\haarcascade_frontalface_alt.xml"));
if (classifier.isNull()) {
System.err.println("Error loading classifier file \"" + classifierName + "\".");
System.exit(1);
}
CanvasFrame frame = new CanvasFrame("Face Detection");
FrameGrabber grabber = new OpenCVFrameGrabber(0);
grabber.start();
IplImage grabbedImage = grabber.grab();
int width = grabbedImage.width();
int height = grabbedImage.height();
IplImage grayImage = IplImage.create(width, height, IPL_DEPTH_8U, 1);
CvMemStorage storage = CvMemStorage.create();
CvPoint hatPoints = new CvPoint(3);
int counter=0;
while (frame.isVisible() && (grabbedImage = grabber.grab()) != null && counter==0)
{
cvCvtColor(grabbedImage, grayImage, CV_BGR2GRAY);
CvSeq faces = cvHaarDetectObjects(grayImage, classifier, storage,
1.1, 3, CV_HAAR_DO_CANNY_PRUNING);
int total = faces.total();
for (int i = 0; i < total; i++)
{
CvRect r = new CvRect(cvGetSeqElem(faces, i));
int x = r.x(), y = r.y(), w = r.width(), h = r.height();
cvRectangle(grabbedImage, cvPoint(x, y), cvPoint(x+w, y+h), CvScalar.RED, 1, CV_AA, 0);
cvRectangle(grabbedImage, cvPoint(x, y), cvPoint(x+w, y+h), CvScalar.BLUE, 1, CV_AA, 0);
// To access the elements of a native array, use the `position()` method
hatPoints.position(0).x(x-w/10); hatPoints.y(y-h/10);
hatPoints.position(1).x(x+w*11/10); hatPoints.y(y-h/10);
hatPoints.position(2).x(x+w/2); hatPoints.y(y-h/2);
cvFillConvexPoly(grabbedImage, hatPoints.position(0), 3, CvScalar.GREEN, CV_AA, 0);
}
//cvSave("D:\\img1.bmp", grabbedImage);
// cvSaveImage("D:\\PhotoGallery.jpg", grabbedImage);
counter=1;
cvThreshold(grayImage, grayImage, 64, 255, CV_THRESH_BINARY);
frame.showImage(grabbedImage);
cvClearMemStorage(storage);
}
grabber.stop();
frame.dispose();
}
}
Original comment by [email protected]
on 15 Mar 2011 at 5:07
from javacv.
Related Issues (20)
- av_interleaved_write_frame() error -22 while writing interleaved video frame HOT 3
- Android video record using H264 format is to large HOT 1
- Error while createFisher/Eigen/LBPHFaceRecognizer() method is called. HOT 7
- FFmpegFrameGrabber doesn't grab upto the end of the video on Android HOT 6
- RTMP streaming problems HOT 1
- Unable to record with sample code on HOT 4
- Question about the applying the proguard on android HOT 2
- CODEC_ID_MPEG1VIDEO,PIX_FMT_YUV420P cannot be resolved to a variable HOT 4
- While using OpenCV 2.4.9 and JavaCV 0.7 in netbeans windows 7 getting error HOT 3
- Help me Dr.Samuel..(Fatal signal 8 (SIGFPE) at 0x00002835 (code=-6), thread 10293 ) HOT 4
- multi processing with opencv HOT 2
- Problem on train method in face recognition HOT 1
- how to rotate video with javacv on android HOT 1
- Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_core from loader dalvik.system.PathClassLoader HOT 1
- .mp4 video not working in splash screen in htc desire 500 HOT 1
- How to grab the RGB frame instead the gray one? HOT 2
- reconstructImageToNewType Method not Found HOT 1
- JavaCV 0.11 getLengthInFrames() HOT 3
- How to apply sepia effect on grabed frame before record it HOT 2
- IplImage Create error, memery allocation problem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javacv.