15 #include <mrpt/otherlibs/do_opencv_includes.h>
30 CStereoGrabber_SVS::CStereoGrabber_SVS(
32 : m_bInitialized(false),
33 m_videoObject(nullptr),
34 m_stereoImage(nullptr),
35 m_disparityParams(nullptr),
36 m_resolutionX(options.frame_width),
37 m_resolutionY(options.frame_height),
38 m_procesOnChip(options.m_procesOnChip),
39 m_calDisparity(options.m_calDisparity),
45 m_videoObject =
static_cast<svsVideoImages*
>(getVideoObject());
46 cout <<
"Using live images:" << endl;
47 cout <<
"svsVideoIdent" << endl;
54 cout <<
" stereo device Opened" << endl;
75 ->SetExposure(0, 0,
true,
true)))
77 cout <<
"Can't set Auto exposure" << endl;
81 cout <<
"Autoexposure set to 0 0" << endl;
95 if (
static_cast<svsVideoImages*
>(
m_videoObject)->CheckParams())
97 cout <<
"Params OK !" << endl;
100 bool ret =
static_cast<svsVideoImages*
>(
m_videoObject)->Start();
103 cout <<
" Start Continuous mode" << endl;
112 cout <<
"Images will be rectified" << endl;
116 cout <<
"Can't set rectification" << endl;
126 ->SetProcMode(PROC_MODE_DISPARITY);
127 cout <<
"Setting STOC disparity mode" << endl;
140 ->SetProcMode(PROC_MODE_OFF);
141 cout <<
"Setting STOC stereo mode" << endl;
147 cout <<
"Can't start continuous capture" << endl;
155 cout <<
"Params Unconsistents !" << endl;
161 cout <<
"Can't open stereo device" << endl;
167 THROW_EXCEPTION(
"This class requires MRPT built with Videre SVS library.");
178 #endif // No need to raise an exception on "#else" since it's already raised
190 static_cast<svsVideoImages*
>(
m_videoObject)->GetImage(500)) &&
205 IplImage* ImageLeft = cvCreateImageHeader(
208 ImageLeft->widthStep =
210 ImageLeft->imageData =
215 IplImage* ImageDisparity = cvCreateImage(
218 unsigned char* ptrOutDisp;
221 ptrDisp =
static_cast<svsStereoImage*
>(
m_stereoImage)->Disparity();
222 ptrOutDisp = (
unsigned char*)ImageDisparity->imageData;
225 ImageDisparity->widthStep ==
226 ImageDisparity->width);
229 for (
int pix = 0; pix < sizeOfMat; pix++, ptrOutDisp++, ptrDisp++)
232 *(ptrOutDisp) = (
unsigned char)((*(ptrDisp) >> 2) & 0x00FF);
240 cvCloneImage(ImageLeft),
242 nullptr , ImageDisparity,
245 out_observation.
swap(
252 IplImage* ImageDisparity = cvCreateImage(
255 unsigned char* ptrOutDisp;
258 ptrDisp =
static_cast<svsStereoImage*
>(
m_stereoImage)->Disparity();
259 ptrOutDisp = (
unsigned char*)ImageDisparity->imageData;
262 ImageDisparity->widthStep ==
263 ImageDisparity->width);
266 for (
int pix = 0; pix < sizeOfMat; pix++, ptrOutDisp++, ptrDisp++)
269 *(ptrOutDisp) = (
unsigned char)((*(ptrDisp) >> 2) & 0x00FF);
277 cvCloneImage(ImageLeft),
279 nullptr , ImageDisparity,
282 out_observation.
swap(
287 IplImage* ImageRight = cvCreateImageHeader(
289 ImageRight->widthStep =
291 ImageRight->imageData =
297 cvCloneImage(ImageLeft),
299 cvCloneImage(ImageRight),
nullptr ,
302 out_observation.
swap(
326 int _frame_width,
int _frame_height,
double _framerate,
int _NDisp,
327 int _Corrsize,
int _LR,
int _Thresh,
int _Unique,
int _Horopter,
328 int _SpeckleSize,
bool _procesOnChip,
bool _calDisparity)