33 , mCamera(new C1394Camera())
51 if (
mCamera->CheckLink() != CAM_SUCCESS) {
55 int numberCameras =
mCamera->GetNumberCameras();
56 bool cameraSelected =
false;
57 for (
int i = 0; i < numberCameras; i++) {
59 LARGE_INTEGER uniqueId;
60 mCamera->GetCameraUniqueID(&uniqueId);
62 convert << std::hex << uniqueId.HighPart << uniqueId.LowPart;
64 cameraSelected =
true;
69 if (!cameraSelected) {
73 if (
mCamera->InitCamera(
true) != CAM_SUCCESS) {
78 if (
mCamera->HasVideoMode(2, 4)) {
79 if (
mCamera->SetVideoFormat(2) != CAM_SUCCESS)
return false;
80 if (
mCamera->SetVideoMode(4) != CAM_SUCCESS)
return false;
83 else if (
mCamera->HasVideoMode(2, 1)) {
84 if (
mCamera->SetVideoFormat(2) != CAM_SUCCESS)
return false;
85 if (
mCamera->SetVideoMode(1) != CAM_SUCCESS)
return false;
88 else if (
mCamera->HasVideoMode(1, 4)) {
89 if (
mCamera->SetVideoFormat(1) != CAM_SUCCESS)
return false;
90 if (
mCamera->SetVideoMode(4) != CAM_SUCCESS)
return false;
93 else if (
mCamera->HasVideoMode(1, 1)) {
94 if (
mCamera->SetVideoFormat(1) != CAM_SUCCESS)
return false;
95 if (
mCamera->SetVideoMode(1) != CAM_SUCCESS)
return false;
98 else if (
mCamera->HasVideoMode(0, 4)) {
99 if (
mCamera->SetVideoFormat(0) != CAM_SUCCESS)
return false;
100 if (
mCamera->SetVideoMode(4) != CAM_SUCCESS)
return false;
135 else if (
mCamera->HasVideoMode(2, 5)) {
136 if (
mCamera->SetVideoFormat(2) != CAM_SUCCESS)
return false;
137 if (
mCamera->SetVideoMode(5) != CAM_SUCCESS)
return false;
140 else if (
mCamera->HasVideoMode(2, 2)) {
141 if (
mCamera->SetVideoFormat(2) != CAM_SUCCESS)
return false;
142 if (
mCamera->SetVideoMode(2) != CAM_SUCCESS)
return false;
145 else if (
mCamera->HasVideoMode(1, 5)) {
146 if (
mCamera->SetVideoFormat(1) != CAM_SUCCESS)
return false;
147 if (
mCamera->SetVideoMode(5) != CAM_SUCCESS)
return false;
150 else if (
mCamera->HasVideoMode(1, 2)) {
151 if (
mCamera->SetVideoFormat(1) != CAM_SUCCESS)
return false;
152 if (
mCamera->SetVideoMode(2) != CAM_SUCCESS)
return false;
155 else if (
mCamera->HasVideoMode(0, 5)) {
156 if (
mCamera->SetVideoFormat(0) != CAM_SUCCESS)
return false;
157 if (
mCamera->SetVideoMode(5) != CAM_SUCCESS)
return false;
166 mCamera->StartImageAcquisitionEx(6, 1, ACQ_START_VIDEO_STREAM);
175 mCamera->StopImageAcquisition();
187 if (
mCamera->AcquireImageEx(
false, NULL) == CAM_SUCCESS) {
196 CameraControlDialog(NULL,
mCamera,
true);
211 unsigned short value;
212 if (serialization->
IsInput()) {
213 if (!serialization->
Serialize(value,
"Gain"))
return false;
214 mCamera->GetCameraControl(FEATURE_GAIN)->SetAutoMode(
false);
215 mCamera->GetCameraControl(FEATURE_GAIN)->SetValue(value);
217 if (!serialization->
Serialize(value,
"AutoExposure"))
return false;
218 mCamera->GetCameraControl(FEATURE_AUTO_EXPOSURE)->SetAutoMode(
false);
219 mCamera->GetCameraControl(FEATURE_AUTO_EXPOSURE)->SetValue(value);
221 if (!serialization->
Serialize(value,
"Shutter"))
return false;
222 mCamera->GetCameraControl(FEATURE_SHUTTER)->SetAutoMode(
false);
223 mCamera->GetCameraControl(FEATURE_SHUTTER)->SetValue(value);
225 if (!serialization->
Serialize(value,
"Brightness"))
return false;
226 mCamera->GetCameraControl(FEATURE_BRIGHTNESS)->SetAutoMode(
false);
227 mCamera->GetCameraControl(FEATURE_BRIGHTNESS)->SetValue(value);
229 if (!serialization->
Serialize(value,
"Gamma"))
return false;
230 mCamera->GetCameraControl(FEATURE_GAMMA)->SetAutoMode(
false);
231 mCamera->GetCameraControl(FEATURE_GAMMA)->SetValue(value);
233 mCamera->GetCameraControl(FEATURE_GAIN)->GetValue(&value);
234 if (!serialization->
Serialize(value,
"Gain"))
return false;
236 mCamera->GetCameraControl(FEATURE_AUTO_EXPOSURE)->GetValue(&value);
237 if (!serialization->
Serialize(value,
"AutoExposure"))
return false;
239 mCamera->GetCameraControl(FEATURE_SHUTTER)->GetValue(&value);
240 if (!serialization->
Serialize(value,
"Shutter"))
return false;
242 mCamera->GetCameraControl(FEATURE_BRIGHTNESS)->GetValue(&value);
243 if (!serialization->
Serialize(value,
"Brightness"))
return false;
245 mCamera->GetCameraControl(FEATURE_GAMMA)->GetValue(&value);
246 if (!serialization->
Serialize(value,
"Gamma"))
return false;
265 if (camera.CheckLink() != CAM_SUCCESS) {
269 int numberCameras = camera.GetNumberCameras();
270 for (
int i = 0; i < numberCameras; i++) {
271 camera.SelectCamera(i);
272 LARGE_INTEGER uniqueId;
273 camera.GetCameraUniqueID(&uniqueId);
275 convert << std::hex << uniqueId.HighPart << uniqueId.LowPart;
276 std::stringstream description;
278 camera.GetCameraVendor(buffer, 500);
279 description << buffer <<
" ";
280 camera.GetCameraName(buffer, 500);
281 description << buffer;
283 devices.push_back(captureDevice);
void stop()
Stops the camera capture.
bool IsInput()
Method for checking if we are inputting or outputting. Can be used from your serializable class...
CaptureDeviceVector enumerateDevices()
Enumerate capture devices currently available.
CaptureDevice captureDevice()
The camera information associated to this capture object.
bool start()
Starts the camera capture.
bool Serialize(Serialization *serialization)
Performs serialization of the class members and configuration.
unsigned long mXResolution
Capture * createCapture(const CaptureDevice captureDevice)
Create Capture class. Transfers onwership to the caller.
bool Serialize(int &data, const std::string &name)
Method for serializing 'int' data element. Used from your serializable class.
CaptureDevice holder for camera information.
bool showSettingsDialog()
Show the settings dialog of the camera.
void registerPlugin(const std::string &captureType, alvar::CapturePlugin *&capturePlugin)
CapturePlugin interface that plugins must implement.
~CapturePluginCmu()
Destructor.
CapturePluginCmu(const std::string &captureType)
Constructor.
CaptureCmu(const CaptureDevice captureDevice)
Constructor.
bool isCapturing()
Test if the camera was properly initialized.
std::string SerializeId()
The identification of the class for serialization.
Capture interface that plugins must implement.
IplImage * captureImage()
Capture one image from the camera.
void convert(const A &a, B &b)
Class for serializing class content to/from file or std::iostream.
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
std::vector< CaptureDevice > CaptureDeviceVector
Vector of CaptureDevices.
unsigned long mYResolution
Implementation of Capture interface for Cmu plugin.
This file implements a capture plugin based on Cmu.