Tuesday, November 26, 2013

JavaCV Tutorial 3 -Video Recording



In this tutorial I've explained the process of recording a video from the Webcam with different resolutions and with different formats.
Setting different Resolutions :
" cvSetCaptureProperty(capture1,CV_CAP_PROP_FRAME_WIDTH,Wd);
        cvSetCaptureProperty(capture1,CV_CAP_PROP_FRAME_HEIGHT,Ht); "

" FrameRecorder recorder1 = new OpenCVFrameRecorder("RecordVid.avi",Wt , Ht); "

"Wd = 1920;1280;720;640;320;
  Ht = 1080;720;480;360;240; "

 Setting Different Codecs :
For MJPG: "  recorder1.setVideoCodec(CV_FOURCC('M','J','P','G')); "
For DIVX: "  recorder1.setVideoCodec(CV_FOURCC('D','I','V','X')); " 
For MP4V: "  recorder1.setVideoCodec(CV_FOURCC('M','P','4','V')); "

Source Code: " https://drive.google.com/file/d/0Bxr1St4kFOnQcDFZRWczc0xwR3c/edit?usp=sharing "





Tuesday, November 19, 2013

JavaCV Tutorial 2 -Video Processing




 In this tutorial I've explained some basic video processing operations such as getting the input from a Video file or a webcam, process those frame and apply some image trans formation operations.
In the function "cvCreateFileCapture("");" , the default location is the project directory from where it loads the Video file, you can also include the path of the video file inside quotes just like in the last tutorial I've explained.
In the function "cvCreateCameraCapture();", 'CV_CAP_ANY ' argument detects the default webcam connected to PC and gets the input from that. But if you are having multiple webcams then you can include arguments like :
Arguments                          Numerical Value
CV_CAP_ANY                          0
CV_CAP_MIL                           100
CV_CAP_VFW                         200
CV_CAP_V4L                           200
CV_CAP_V4L2                         200
CV_CAP_FIREWIRE               300
CV_CAP_IEEE1394                  300
CV_CAP_DC1394                     300
CV_CAP_CMU1394                 300

In " if(c==27) " statement you can compare the value with any other key pressed and break the loop, visit the link below to know the ascii values of different keys :
" http://www.lucidtechnologies.info/ascii.htm "

Source Code: " https://drive.google.com/file/d/0Bxr1St4kFOnQT3ZhbFlTS2V1UFE/edit?usp=sharing "


Monday, November 18, 2013

JavaCV Tutorial 1 -Basics





In this tutorial I've explained some simple image transformation techniques such as converting the RGB image into a HSV and Grayscale and saving the image file in different locations .
In "cvWaitKey()" function, you can include an integer value to indicate the amount time that the function has to wait for the user input.
Eg: cvWaitKey(1000) will wait for 1second for user I/p and automatically executes the statements below it if doesn't get any user i/p within the time specified.
Source Code :  " https://drive.google.com/file/d/0Bxr1St4kFOnQS3d1VEpjc0ZxZHM/edit?usp=sharing "