#include <stdio.h>
#include "videoInput.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int main()
{
//create a videoInput object
videoInput VI;
//Prints out a list of available devices and returns num of devices found
int numDevices = VI.listDevices();
int device1 = 0; //this could be any deviceID that shows up in listDevices
//setup the first device - there are a number of options:
VI.setUseCallback(false);
VI.setupDevice(device1); //setup the first device with the default settings
//As requested width and height can not always be accomodated
//make sure to check the size once the device is setup
int width = VI.getWidth(device1);
int height = VI.getHeight(device1);
int size = VI.getSize(device1);
IplImage * img = cvCreateImage(cvSize(width,height), IPL_DEPTH_8U, 3);
cvNamedWindow("in",1);
while(1)
{
//to get the data from the device first check if the data is new
printf("Hello World\n");
if(VI.isFrameNew(device1)){
VI.getPixels(device1, (unsigned char *)img->imageData, false, false);
}
cvShowImage("in",img);
cvWaitKey(1);
Sleep(200);
}
//Shut down devices properly
VI.stopDevice(device1);
cvDestroyWindow("in");
return 0;
}
I am using Logitech webcam too. Ya, I remarked out the if statement earlier.
Just another note, I notice that it takes longer to start the the program if using DirectShow. I am currently using HighGui cvCaptureFromCAM for my computer vision with no problems so far. Im using OpenCV downloaded from sourceforge. Sometimes I wonder why you guys still using the older one…must be for some reason?
But I think I need to expore DirectShow due to WindowsXP phasing out.
Does cvCaptureFromCAM work with Vista?
Here are the program execution messages. Anything funny you see?
***** VIDEOINPUT LIBRARY - 0.1991 - TFW07 *****
VIDEOINPUT SPY MODE!
SETUP: Looking For Capture Devices
SETUP: 0) Logitech QuickCam IM/Connect
SETUP: 1 Device(s) found
SETUP: Setting up device 0
SETUP: Logitech QuickCam IM/Connect
SETUP: Couldn’t find preview pin using SmartTee
SETUP: Default Format is set to 320 by 240
SETUP: Device is setup and ready to capture.
I am using Logitech webcam too. Ya, I remarked out the if statement earlier.
Hmm - would you mind trying the openFrameworks movieGrabberExample (or ofxOpenCVExample ) with your camera?
If it freezes with those examples then I am pretty sure it is a videoInput bug.
Just another note, I notice that it takes longer to start the the program if using DirectShow. I am currently using HighGui cvCaptureFromCAM for my computer vision with no problems so far. Im using OpenCV downloaded from sourceforge. Sometimes I wonder why you guys still using the older one…must be for some reason?
I think 005 release is using the newest ones? What release are you working with?
VideoInput takes longer because it is doing a lot of checks for size and video formats that cvCaptureFromCAM doesn’t - as a result I think it supports a lot more hardware than cvCaptureFromCAM (but it is slower to start).
But I think I need to expore DirectShow due to WindowsXP phasing out.
Does cvCaptureFromCAM work with Vista?
No idea - I refuse to install vista
Here are the program execution messages. Anything funny you see?
No that all looks normal.
Very strange as I have never heard of any issues with logitech cameras.
Let me know how the of video capture examples run (005 release) - I would be curious to hear how they run.
a) I tried movieGrabberExample and it is not working in 0.05
b) Im working with VIDEOINPUT LIBRARY - 0.1991
c) When use the older VideoInput Library - 0.199 it worked
The root cause of the problem is from 0.1991 of the library