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.

9/12/2013

compare appearance photos macbook air haswell and lg notebook z360








macbook air haswell 13 inch, appearance photos












very very good equipment.

Satisfied in all.
However, our country has been concentrated in the Windows environment application services, so
Mac to use a lot of uncomfortable.
To use ms office (of course the Mac version is also available), games, Banking and I also should be developed in vs2012.

There is vmware(fusion 5,6), parallels to use window with mac.
But requires a lot of resources and slow (especially high-quality video, 3d game).
And sometimes the window is abnormal operating.

Using Boot Camp that is obscure.
Because when you boot into Windows, the Mac would be well not to use.







LG notebook Z360 appearance photos

The screen is very good.
Thin and light and speed is fast.
But.. typing is uncomfortable, track pad is not speed reaction like mac 
The click part is to touch, difficult to adapt.

LG notebook Z360 appearance photos



supplied contents






leather case


Overall, not bad laptop.
So I had bought 4 more. ^^

9/09/2013

OpenCV, To create Histogram and Draw example source code

Example source code to make histogram and drawing.
Show the 'mareHistogram' function.
Input is Mat. The property is CV_8U and binary image.
Output is also Mat. The output Mat is image of histogram.
If you want to get histogram value array, you should get mhist Mat instead of histo in the function.

Thank you.









histogram, countNonZero, vertical, horizontal



9/02/2013

OpenCV Video Writer example source code (VideoWriter function)

This is video writer example source code.
This source code was used from video load & display.

...
int main()
{
    VideoCapture capture("rhinos.avi");
    Mat frame;

    //Set properties
    int askFileTypeBox = 0; //-1 is show box of codec
    int Color = 1;
    Size S = Size((int)capture.get(CV_CAP_PROP_FRAME_WIDTH), (int)capture.get(CV_CAP_PROP_FRAME_HEIGHT));

    //make output video file
    VideoWriter outVideo;
    //save video file by origin paramers
    outVideo.open(".\\outVideo.avi", askFileTypeBox, capture.get(CV_CAP_PROP_FPS), S, Color);

    double fps = capture.get(CV_CAP_PROP_FPS);
    //check
    if (!capture.isOpened())
    {
        printf("AVI file can not open.\n");
        return 0;
    }

    //create window
    namedWindow("w");

    while (1)
    {
        //grab frame from file & throw to Mat
        capture >> frame;
        if (frame.empty()) //Is video end?
            break;

        //processing example
        //Sobel(frame, frame, frame.depth(), 1, 0);

        ////////////////////
        //outVideo.write(frame);
        outVideo << frame;
        //display and delay
        imshow("w", frame);

        //delay by origin fps
        if (waitKey((1 / fps) * 1000) > 0)
            break;

    }

    return 0;
}
...

OpenCV, Video file load and display example source code (using VideoCapture function)

This is example source code to load video file and display

...
//file load
 VideoCapture capture(".\\video.avi");
 Mat frame;

 //check
 if( !capture.isOpened() )
 {
  printf("AVI file can not open.\n");
  return;
 }
 
 //create window
 namedWindow("w");
 
 while(1)
 {
  //grab frame from file & throw to Mat
  capture >> frame;
  if(frame.empty() ) //Is video end?
   break;
  
  //processing example
  Sobel(frame,frame,frame.depth(),1,0);
  ////////////////////

  //display and delay
  imshow("w", frame);
  if(waitKey(10) > 0)
   break;
 }
...

Thank you.