0

I have found about 10 questions on this theme but I couldn't get any answer from them, sorry.

I am basically trying to make an open cv application to run with the input from a dslr camera.

At the moment, I am using processing, getting the camera input from syphon, then using it on processing limited open cv. Since I need to play with pose estimative, I couldn't do it on processing. Plus, I have got only 10 fps using syphon, opencv, plus artoolkit libraries...not good for my prototype.

I am trying to do use open cv 3.0. I got the calibration sample file working using the webcam. I just wanted to replace the webcam input by the dslr camera using EDSDK. But all the pieces of code I have found as reference are completely disconnected (different versions/languages).

The EDSDK sample file that comes with the SDK is too complex, so I can't deduce the code. I don't need any complexity (UI, buttons, memory card access, etc). Just the live camera input working as a webcam.

This is the simplest code I could make to retrieve the webcam input on opencv.

#include "opencv2/opencv.hpp"
#import "EDSDK.h" //probably working fine

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // replace here
    if(!cap.isOpened())  // replace here
        return -1;

    namedWindow("edges",1);
    for(;;)
    {
        Mat frame;
        cap >> frame; // replace here
        imshow("frame", frame); //shows it
        if(waitKey(30) >= 0) break;
    }
    return 0;
}

Any suggestion to help me replacing the webcam in this lines?

Thanks

Community
  • 1
  • 1
Bontempos
  • 77
  • 8

1 Answers1

1

Presence of EDSDK.h means you should use camera API to get data, not VideoCapture cap(0). Out of the box OpenCV can use VideoCapture for XIMEA cameras only afaik (if you turn it on in makefile). So you have to find in camera's API example how to get data pointer, convert it to the one of common format and then copy this pointer to you Mat.data using constructor:

Mat(image.height, image.width, CV_8UC3, dataPointer)
Vit
  • 793
  • 4
  • 17