Noskol
Noskol

Reputation: 325

OpenCV + VideoInput.lib HD camera

I have a Creative Sync HD and I saw that OpenCV does not support resolution higher than 640x480. I found a solution - videoinput.lib, but I have no idea how to use it. I just download a compiled lib for VC 2008, but I work on 2012 (maybe that's the problem). Ok, so I put .h in project and .lib just in the VC11 lib folder in program files. I go to linker and add lib to Additional Dependencies. Now I tried to write code, but I cannot find any documentation of videoinput, also I'm not very good at OpenCV as well. Can somebody give me some simple code to check if it works? I used:

#include <stdafx.h>
#include "videoInput.h"
#include "opencv/cv.h"
#include "opencv/highgui.h"

#include "opencv2\opencv.hpp"

int main()
{
    videoInput VI;
    int numDevices = VI.listDevices();
    int device1= 0;
    VI.setupDevice(device1);
    int width = VI.getWidth(device1);
    int height = VI.getHeight(device1);
    IplImage* image= cvCreateImage(cvSize(width, height), 8, 3);
    unsigned char* yourBuffer = new unsigned char[VI.getSize(device1)];
    cvNamedWindow("test");
    while(1)
    {
        VI.getPixels(device1, yourBuffer, false, false);
        image-&gt;imageData = (char*)yourBuffer;
        cvConvertImage(image, image, CV_CVTIMG_FLIP);
        cvShowImage("test", image);
        if(cvWaitKey(15)==27) break;
    }

    VI.stopDevice(device1);
    cvDestroyWindow("test");
    cvReleaseImage(&amp;image);

    return 0;
}

But I have a lot of errors (gt, amp, imagedata undefined). Maybe I installed the videoinput.lib wrong. I'm sure that OpenCV works well, and I use the latest version (2.4.6).

Upvotes: 0

Views: 1823

Answers (1)

berak
berak

Reputation: 39816

that VideoInput lib is already part of Opencv(and it's the default Capture implementation on windows).

so i guess, compiling it again won't help your original problem.

Upvotes: 1

Related Questions