15 #include <mrpt/3rdparty/do_opencv_includes.h> 30 CStereoGrabber_SVS::CStereoGrabber_SVS(
32 : m_resolutionX(options.frame_width),
33 m_resolutionY(options.frame_height),
34 m_procesOnChip(options.m_procesOnChip),
35 m_calDisparity(options.m_calDisparity),
41 m_videoObject =
static_cast<svsVideoImages*
>(getVideoObject());
42 cout <<
"Using live images:" << endl;
43 cout <<
"svsVideoIdent" << endl;
50 cout <<
" stereo device Opened" << endl;
71 ->SetExposure(0, 0,
true,
true)))
73 cout <<
"Can't set Auto exposure" << endl;
77 cout <<
"Autoexposure set to 0 0" << endl;
91 if (static_cast<svsVideoImages*>(
m_videoObject)->CheckParams())
93 cout <<
"Params OK !" << endl;
96 bool ret =
static_cast<svsVideoImages*
>(
m_videoObject)->Start();
99 cout <<
" Start Continuous mode" << endl;
108 cout <<
"Images will be rectified" << endl;
112 cout <<
"Can't set rectification" << endl;
122 ->SetProcMode(PROC_MODE_DISPARITY);
123 cout <<
"Setting STOC disparity mode" << endl;
136 ->SetProcMode(PROC_MODE_OFF);
137 cout <<
"Setting STOC stereo mode" << endl;
143 cout <<
"Can't start continuous capture" << endl;
151 cout <<
"Params Unconsistents !" << endl;
157 cout <<
"Can't open stereo device" << endl;
163 THROW_EXCEPTION(
"This class requires MRPT built with Videre SVS library.");
174 #endif // No need to raise an exception on "#else" since it's already raised 186 static_cast<svsVideoImages*>(
m_videoObject)->GetImage(500)) &&
201 IplImage* ImageLeft = cvCreateImageHeader(
204 ImageLeft->widthStep =
206 ImageLeft->imageData =
211 IplImage* ImageDisparity = cvCreateImage(
214 unsigned char* ptrOutDisp;
217 ptrDisp =
static_cast<svsStereoImage*
>(
m_stereoImage)->Disparity();
218 ptrOutDisp = (
unsigned char*)ImageDisparity->imageData;
221 ImageDisparity->widthStep ==
222 ImageDisparity->width);
225 for (
int pix = 0; pix < sizeOfMat; pix++, ptrOutDisp++, ptrDisp++)
228 *(ptrOutDisp) = (
unsigned char)((*(ptrDisp) >> 2) & 0x00FF);
236 cvCloneImage(ImageLeft),
238 nullptr , ImageDisparity,
241 out_observation.
swap(
248 IplImage* ImageDisparity = cvCreateImage(
251 unsigned char* ptrOutDisp;
254 ptrDisp =
static_cast<svsStereoImage*
>(
m_stereoImage)->Disparity();
255 ptrOutDisp = (
unsigned char*)ImageDisparity->imageData;
258 ImageDisparity->widthStep ==
259 ImageDisparity->width);
262 for (
int pix = 0; pix < sizeOfMat; pix++, ptrOutDisp++, ptrDisp++)
265 *(ptrOutDisp) = (
unsigned char)((*(ptrDisp) >> 2) & 0x00FF);
273 cvCloneImage(ImageLeft),
275 nullptr , ImageDisparity,
278 out_observation.
swap(
283 IplImage* ImageRight = cvCreateImageHeader(
285 ImageRight->widthStep =
287 ImageRight->imageData =
293 cvCloneImage(ImageLeft),
295 cvCloneImage(ImageRight),
nullptr ,
298 out_observation.
swap(
322 int _frame_width,
int _frame_height,
double _framerate,
int _NDisp,
323 int _Corrsize,
int _LR,
int _Thresh,
int _Unique,
int _Horopter,
324 int _SpeckleSize,
bool _procesOnChip,
bool _calDisparity)
unsigned int m_resolutionX
#define THROW_EXCEPTION(msg)
int m_NDisp
number of STOC's disparities (Default: 64 )
Contains classes for various device interfaces.
virtual ~CStereoGrabber_SVS()
Destructor.
double framerate
STOC camera frame rate (Default: 30 fps)
#define ASSERT_(f)
Defines an assertion mechanism.
int frame_width
Capture resolution (Default: 640x480)
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
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.
TCaptureOptions_SVS m_options
struct _IplImage IplImage
void swap(CObservationStereoImages &o)
Do an efficient swap of all data members of this object with "o".
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)
unsigned int m_resolutionY
bool getStereoObservation(mrpt::obs::CObservationStereoImages &out_observation)
Grab stereo images, and return the pair of rectified images.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.