26 #include "Helpers/helpers.h"
39 #include <SimoxUtility/algorithm/string/string_tools.h>
45 void IEEE1394ImageProvider::onInitCapturingImageProvider()
49 videoDimension = getProperty<ImageDimension>(
"VideoMode").getValue();
50 colorFormat = getProperty<ColorFormat>(
"ColorMode").getValue();
51 bayerPatternType = getProperty<BayerPatternType>(
"BayerPatternType").getValue();
52 isFormat7Mode = getProperty<bool>(
"Format7Mode").getValue();
53 frameRate = getProperty<float>(
"FrameRate").getValue();
54 std::string uidStr = getProperty<std::string>(
"CameraUIDs").getValue();
58 setNumberImages(uids.size());
59 setImageFormat(videoDimension, colorFormat.imageType, bayerPatternType);
60 setImageSyncMode(eCaptureSynchronization);
85 std::string leftUID, rightUID;
96 rightUID = uids.at(1);
111 void IEEE1394ImageProvider::onExitCapturingImageProvider()
113 if (ppImages != NULL)
115 for (
int i = 0; i < getNumberImages(); i++)
127 void IEEE1394ImageProvider::onStartCapture(
float frameRate)
131 ppImages =
new CByteImage*[2];
133 for (
int i = 0; i < getNumberImages(); i++)
136 getImageFormat().type);
141 if (!ieee1394Capturer->OpenCamera())
143 throw visionx::exceptions::user
144 ::StartingCaptureFailedException(
"Opening cameras failed!");
148 ieee1394Capturer->SetGain((
unsigned int) - 1);
149 ieee1394Capturer->SetExposure((
unsigned int) - 1);
150 ieee1394Capturer->SetShutter((
unsigned int) - 1);
151 ieee1394Capturer->SetWhiteBalance(50, 50);
156 void IEEE1394ImageProvider::onStopCapture()
159 ieee1394Capturer->CloseCamera();
161 if (ppImages != NULL)
163 for (
int i = 0; i < getNumberImages(); i++)
175 bool IEEE1394ImageProvider::capture(
void** ppImageBuffers)
177 bool succeeded =
false;
179 switch (getImageFormat().type)
181 case visionx::eBayerPattern:
187 case visionx::eGrayScale:
188 succeeded = ieee1394Capturer->CaptureImage(ppImages);
207 ImageFormatInfo imageFormat = getImageFormat();
211 int imageSize = imageFormat.dimension.width * imageFormat.dimension.height * imageFormat.bytesPerPixel;
212 memcpy(ppImageBuffers[0], ppImages[0]->pixels, imageSize);
213 memcpy(ppImageBuffers[1], ppImages[1]->pixels, imageSize);