void init();
int index, width, height,fourcc;
+ int widthSet, heightSet;
IplImage* frame;
static videoInput VI;
};
index = -1;
frame = 0;
width = height = fourcc = -1;
+ widthSet = heightSet = -1;
CoInitialize(0);
}
index = -1;
cvReleaseImage(&frame);
}
- width = height = -1;
+ widthSet = heightSet = width = height = -1;
}
// Initialize camera input
{
VI.stopDevice(index);
VI.setIdealFramerate(index,fps);
- VI.setupDevice(index);
+ if (widthSet > 0 && heightSet > 0)
+ VI.setupDevice(index, widthSet, heightSet);
+ else
+ VI.setupDevice(index);
}
- break;
+ return VI.isDeviceSetup(index);
}
VI.setIdealFramerate(index, fps);
VI.setupDeviceFourcc(index, width, height, fourcc);
}
- width = height = fourcc = -1;
- return VI.isDeviceSetup(index);
+
+ bool success = VI.isDeviceSetup(index);
+ if (success)
+ {
+ widthSet = width;
+ heightSet = height;
+ width = height = fourcc = -1;
+ }
+ return success;
}
return true;
}