9/30/2013

OpenCV 2.46 and SurfFeatureDetector

If you use SurfFeatureDetector function, you should include "opencv2\nonfree\nonfree.hpp" and "opencv_nonfree246.lib" .

This mean is surf and sift is not free, give the money to use in commercially.
But how to know using this lib or not?
em..
I don't know.

Thank you.

OpenCV 2-cams view sample source code

This source is advanced from http://feelmare.blogspot.kr/2013/09/opencv-video-capture-using-videocapture.html.

/////
void main()
{
 VideoCapture stream1(0);   //0 is the id of video device.0 if you have only one camera
 VideoCapture stream2(1);   //0 is the id of video device.0 if you have only one camera
 
 if (!stream1.isOpened()) { //check if video device has been initialised
  cout << "cannot open camera 1";
 }

 if (!stream2.isOpened()) { //check if video device has been initialised
  cout << "cannot open camera 2";
 }


 namedWindow("Processing");
 namedWindow("CAM1");
 namedWindow("CAM2");


 //unconditional loop
 while (true) {
  Mat cameraFrame1;
  stream1.read(cameraFrame1); //get one frame form video
  imshow("CAM1", cameraFrame1);

  Mat cameraFrame2;
  stream2.read(cameraFrame2); //get one frame form video
  imshow("CAM2", cameraFrame2);

  

  if (waitKey(30) >= 0)
   break;
 }

 destroyAllWindows();
 
 
}
/////





OpenCV video capture (using VideoCapture, Mat class)

The method to video capture using VideoCapture function and Mat class.

Source code is..

////
void main()
{
 VideoCapture stream1(1);   //0 is the id of video device.0 if you have only one camera
 
 if (!stream1.isOpened()) { //check if video device has been initialised
  cout << "cannot open camera";
 }

 namedWindow("Processing");
 namedWindow("Origin");

 //unconditional loop
 while (true) {
  Mat cameraFrame;
  stream1.read(cameraFrame); //get one frame form video
  imshow("Origin", cameraFrame);

  Sobel(cameraFrame, cameraFrame, CV_8U, 1, 0); //sobel processing
  imshow("Processing",cameraFrame);

  if (waitKey(30) >= 0)
   break;
 }

 destroyAllWindows();
 
 
}
////



Reference this page
The method to capture video using cvCaptureFromCAM
http://feelmare.blogspot.kr/2011/11/web-cam-capture-source-code-using.html
And reference to set opencv and know basic code structure.
http://feelmare.blogspot.kr/2013/08/visual-studio-2012-opencv-246-setting.html

This source code is referenced from "http://thefreecoder.wordpress.com/2012/09/11/opencv-c-video-capture/"

Thank you.