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.");
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)
bool getStereoObservation(mrpt::obs::CObservationStereoImages &out_observation)
Grab stereo images, and return the pair of rectified images.
virtual ~CStereoGrabber_SVS(void)
Destructor.
unsigned int m_resolutionX
unsigned int m_resolutionY
TCaptureOptions_SVS m_options
Observation class for either a pair of left+right or left+disparity images from a stereo camera.
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
#define ASSERT_(f)
Defines an assertion mechanism.
#define THROW_EXCEPTION(msg)
Contains classes for various device interfaces.
This namespace contains representation of robot actions and observations.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Options used when creating a STOC Videre Design camera capture object.
int frame_width
Capture resolution (Default: 640x480)
TCaptureOptions_SVS(int _frame_width=640, int _frame_height=480, double _framerate=30, int _NDisp=64, int _Corrsize=15, int _LR=false, int _Thresh=10, int _Unique=13, int _Horopter=0, int _SpeckleSize=100, bool _procesOnChip=true, bool _calDisparity=true)
double framerate
STOC camera frame rate (Default: 30 fps)
int m_NDisp
number of STOC's disparities (Default: 64 )