Ask Your Question
0

Don't capture frames of the camera???

asked 2014-02-02 09:43:40 -0600

tiho_bg gravatar image

updated 2014-02-05 04:47:48 -0600

I am working with opencv 2.48, visual studio 2010 C++ and a professional camera UI-1490SE (uEye camera). I have realised that opencv is working better with normal web-cams but with professional cameras it is necessary to make all settings first. I would like to start live streaming of the camera using opencv but it is something wrong in my code. I think that I can't capture frames of the camera. The screen is black all the time. Here it is:

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>

using namespace cv;

int main ()
{
  VideoCapture cap(0);
  cap.open(0);
  if (false)
  {return -1;}

  cap.set(CV_CAP_PROP_FRAME_WIDTH, 3840);
  cap.set(CV_CAP_PROP_FRAME_HEIGHT, 2748);
  cap.set(CV_CAP_PROP_FPS, 30.00);

  int width = cap.get(CV_CAP_PROP_FRAME_WIDTH);
  int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT);
  double fps = cap.get(CV_CAP_PROP_FPS);

  IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
  cvNamedWindow("wind");

  Mat frame;
  while(1)
  {
    frame = videoFrame;
    cap.read(frame);

    if(!frame.data) break;
    imshow("wind", frame);
    if (waitKey(30) == 27)
    {
      cout << "esc key:" << endl;
      break;
    }
  }
  cvReleaseImage(&videoFrame);
  cvDestroyWindow("wind");
  return 0;
}
edit retag flag offensive close merge delete

Comments

I think this website contains a really usefull wrapper for uEye cameras. It uses the original framework and combines it with openCV.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-05 04:51:37 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2014-02-03 04:22:12 -0600

Geppertm gravatar image

You´ve got to use uEye-Lib to grab an Image. After that you can create a Mat with the width,highth and deepth of the grabed Image, then copy the Data from the Image to the Mat.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-02-02 09:43:40 -0600

Seen: 1,445 times

Last updated: Feb 05 '14