16 #include <mrpt/otherlibs/do_opencv_includes.h> 19 # include <svsclass.h> 32 m_bInitialized(false),
35 m_disparityParams(NULL),
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;
67 if(!(static_cast<svsVideoImages*>(
m_videoObject)->SetExposure(0,0,
true,
true)))
69 cout<<
"Can't set Auto exposure"<<endl;
72 cout<<
"Autoexposure set to 0 0"<<endl;
84 if(static_cast<svsVideoImages*>(
m_videoObject)->CheckParams())
86 cout<<
"Params OK !"<<endl;
89 bool ret =
static_cast<svsVideoImages*
>(
m_videoObject)->Start();
92 cout<<
" Start Continuous mode"<<endl;
97 ret =
static_cast<svsVideoImages*
>(
m_videoObject)->SetRect(
true);
99 cout<<
"Images will be rectified"<<endl;
101 cout<<
"Can't set rectification"<<endl;
108 static_cast<svsVideoImages*
>(
m_videoObject)->SetProcMode(PROC_MODE_DISPARITY);
109 cout<<
"Setting STOC disparity mode"<<endl;
118 static_cast<svsVideoImages*
>(
m_videoObject)->SetProcMode(PROC_MODE_OFF);
119 cout<<
"Setting STOC stereo mode"<<endl;
125 cout<<
"Can't start continuous capture"<<endl;
138 cout<<
"Params Unconsistents !"<<endl;
145 cout<<
"Can't open stereo device"<<endl;
151 THROW_EXCEPTION(
"This class requires MRPT built with Videre SVS library.")
162 #endif // No need to raise an exception on "#else" since it's already raised upon construction. 181 ImageLeft->widthStep=ImageLeft->width;
182 ImageLeft->imageData =(
char*) static_cast<svsStereoImage*>(
m_stereoImage)->Left();
188 unsigned char *ptrOutDisp;
191 ptrDisp =
static_cast<svsStereoImage*
>(
m_stereoImage)->Disparity();
192 ptrOutDisp = (
unsigned char*) ImageDisparity->imageData;
194 ASSERT_(ImageDisparity->widthStep==ImageDisparity->width);
196 for(
int pix = 0;pix<sizeOfMat;pix++,ptrOutDisp++,ptrDisp++ )
199 *(ptrOutDisp) = (
unsigned char)((*(ptrDisp)>>2)&0x00FF);
206 cvCloneImage( ImageLeft ),
211 out_observation.
swap(ret_obj);
218 unsigned char *ptrOutDisp;
221 ptrDisp =
static_cast<svsStereoImage*
>(
m_stereoImage)->Disparity();
222 ptrOutDisp = (
unsigned char*) ImageDisparity->imageData;
224 ASSERT_(ImageDisparity->widthStep==ImageDisparity->width);
226 for(
int pix = 0;pix<sizeOfMat;pix++,ptrOutDisp++,ptrDisp++ )
229 *(ptrOutDisp) = (
unsigned char)((*(ptrDisp)>>2)&0x00FF);
236 cvCloneImage( ImageLeft ),
241 out_observation.
swap(ret_obj);
248 ImageRight->widthStep=ImageRight->width;
249 ImageRight->imageData =(
char*) static_cast<svsStereoImage*>(
m_stereoImage)->Right();
253 cvCloneImage( ImageLeft ),
254 cvCloneImage( ImageRight ),
258 out_observation.
swap(ret_obj);
281 int _Corrsize,
int _LR ,
int _Thresh,
int _Unique,
int _Horopter,
int _SpeckleSize,
bool _procesOnChip,
bool _calDisparity)
unsigned int m_resolutionX
virtual ~CStereoGrabber_SVS(void)
Destructor.
int m_NDisp
number of STOC's disparities (Default: 64 )
#define THROW_EXCEPTION(msg)
Contains classes for various device interfaces.
double framerate
STOC camera frame rate (Default: 30 fps)
int frame_height
Capture resolution (Default: 640x480)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
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
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.