1 | initial version |
public class CapturingExample{
CvCapture capture;
IplImage frame;
public void Capturing() {
capture = cvCreateCameraCapture(-1);
if(capture!=null)
{
while(true)
{
frame = cvQueryFrame(capture);
cvShowImage("heloo", frame.asCvMat());
cvSaveImage("hi.jpg", frame.asCvMat());//just saving image..
}
}
else System.out.println("errro");
}
public static void main(final String[] args) {
CapturingExample example = new CapturingExample();
example.Capturing();
}
}
2 | No.2 Revision |
public class CapturingExample{
CvCapture capture;
IplImage frame;
public void Capturing() {
capture = cvCreateCameraCapture(-1);
if(capture!=null)
{
while(true)
{
frame = cvQueryFrame(capture);
cvShowImage("heloo", frame.asCvMat());
cvSaveImage("hi.jpg", frame.asCvMat());//just saving image..
}
}
else System.out.println("errro");
}
public static void main(final String[] args) {
CapturingExample example = new CapturingExample();
example.Capturing();
}
}
3 | No.3 Revision |
public class CapturingExample{
CvCapture capture;
IplImage frame;
public void Capturing() {
capture = cvCreateCameraCapture(-1);
if(capture!=null)
{
while(true)
{
frame = cvQueryFrame(capture);
cvShowImage("heloo", frame.asCvMat());
cvSaveImage("hi.jpg", frame.asCvMat());//just saving image..
}
}
else System.out.println("errro");
}
}
}
4 | No.4 Revision |
Your code should be like this.
public class CapturingExample{
CvCapture capture;IplImage frame;public void Capturing() { capture = cvCreateCameraCapture(-1); if(capture!=null) { while(true) { frame = cvQueryFrame(capture); cvShowImage("heloo", frame.asCvMat()); cvSaveImage("hi.jpg", frame.asCvMat());//just saving image.. } } else System.out.println("errro"); } public static void main(final String[] args) { CapturingExample example = new CapturingExample(); example.Capturing(); } }
Here you can get some hints for converting opencv to javacv. Hints for Converting OpenCV C/C++ code to JavaCV