pgr_stereocam.h
Go to the documentation of this file.
1 
10 #ifndef PGR_STEREOCAM_H_
11 #define PGR_STEREOCAM_H_
12 
13 //=============================================================================
14 // Copyright 2007 Point Grey Research, Inc. All Rights Reserved.
15 //
16 // This software is the confidential and proprietary information of Point
17 // Grey Research, Inc. ("Confidential Information"). You shall not
18 // disclose such Confidential Information and shall use it only in
19 // accordance with the terms of the license agreement you entered into
20 // with Point Grey Research Inc.
21 //
22 // PGR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
23 // SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 // IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE, OR NON-INFRINGEMENT. PGR SHALL NOT BE LIABLE FOR ANY DAMAGES
26 // SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
27 // THIS SOFTWARE OR ITS DERIVATIVES.
28 //
29 //=============================================================================
30 
31 //=============================================================================
32 //
33 // pgr_stereocam.h
34 //
35 //=============================================================================
36 
37 //=============================================================================
38 // System Includes
39 //=============================================================================
40 
41 //#include "/usr/local/include/dc1394/control.h"
42 //#include "/usr/local/include/dc1394/control.h"
43 #include <dc1394/control.h>
44 #include <dc1394/conversions.h>
45 #include <dc1394/video.h>
46 //=============================================================================
47 // PGR Includes
48 //=============================================================================
49 #include <triclops.h>
50 
51 #include <string.h>
52 
53 
54 // An enum type that itemizes the possible PGR Stereo cameras
55 typedef enum
56 {
62 
63 // A structure that contains all information you need to access PGR Stereo
64 // cameras
65 typedef struct
66 {
67  dc1394camera_t* camera;
69  dc1394color_filter_t bayerTile;
70  bool bColor;
71  unsigned int nRows;
72  unsigned int nCols;
73  unsigned int nBytesPerPixel;
75 
76 
77 //=============================================================================
78 // Name: isStereoCamera
79 //
80 // Input:
81 // camera - The camera to be queried
82 //
83 // Return value:
84 // A boolean value that is "true" if the camera is recognized as a PGR Stereo
85 // camera and "false" otherwise.
86 //
87 // Description:
88 // This function determines via checking the model string of the camera
89 // whether it is a known PGR stereo camera model.
90 //
91 //=============================================================================
92 bool
93 isStereoCamera( dc1394camera_t* camera );
94 
95 //=============================================================================
96 // Name: getCameraModel
97 //
98 // Input:
99 // camera - The camera to be queried
100 //
101 // Return value:
102 // Returns an enum value that defines which camera model this camera is.
103 //
104 //=============================================================================
106 getCameraModel( dc1394camera_t* camera );
107 
108 //=============================================================================
109 // Name: queryStereoCamera
110 //
111 // Input:
112 // camera - The camera to be queried
113 //
114 // Output:
115 // stereoCamera - a structure that contains all the required information
116 // about this stereo camera
117 //
118 // Description:
119 // This function queries information from the stereo camera and determines
120 // information that is required to populate the PGRStereoCamera_t structure.
121 // This includes information like what model and resolution the camera is and
122 // whether the camera is color or B&W.
123 //
124 //=============================================================================
125 dc1394error_t
126 queryStereoCamera( dc1394camera_t* camera,
127  PGRStereoCamera_t * stereoCamera );
128 
129 //=============================================================================
130 // Name: setStereoVideoCapture
131 //
132 // Input:
133 // stereoaAmera - The camera to grab from
134 //
135 // Description:
136 // This function figures out based on the model of the stereo camera what
137 // format and mode the camera should be set up to transfer data in.
138 //
139 // Note: currently always sets the maximum framerate.
140 //
141 //=============================================================================
142 dc1394error_t
144 
145 //=============================================================================
146 // Name: startTransmission
147 //
148 // Input:
149 // stereoCamera - The camera to grab from
150 //
151 // Description:
152 // In the libdc1394 examples, there is a wait loop that waits after transmission
153 // is requested until the transmission has successfully started. This seemed
154 // like a nice thing to hide from every program so it is bundled up in here.
155 //=============================================================================
156 dc1394error_t
157 startTransmission( PGRStereoCamera_t* stereoCamera );
158 
159 //=============================================================================
160 // Name: extractImagesColor
161 //
162 // Input:
163 // stereoCamera - The camera to grab from
164 // bayerMethod - The requested method for performing bayer->color translations
165 //
166 // Output:
167 // pucDeInterleaved - a buffer to hold the de-interleaved bayer images
168 // size is (nrows * ncols * nimages)
169 // allocated outside this function
170 // pucRGB - a buffer to hold the RGB images
171 // size is (nrows * ncols * nimages * 3)
172 // allocated outside this function
173 // pucGreen - a buffer to hold the green channels of the images
174 // size is (nrows * ncols * nimages)
175 // allocated outside this function
176 // ppucRightRGB - a pointer to the right RGB buffer (into pucRGB)
177 // size is (nrows * ncols * 3)
178 // points into pucRGB
179 // ppucLeftRGB - a pointer to the left RGB buffer
180 // size is (nrows * ncols * 3)
181 // points into pucRGB
182 // ppucCenterRGB - a pointer to the center RGB buffer
183 // size is (nrows * ncols * 3)
184 // points into pucRGB
185 // This is only valid for a BB XB3
186 // pTriclopsInput - the Triclops input
187 // points into pucGreen
188 //
189 // Description:
190 // A function to extract the grab buffer from the libdc1394 camera, and to
191 // perform the required de-interleaving and bayer color processing on the
192 // images to generate a left and right color image and a TriclopsInput for
193 // stereo processing.
194 //=============================================================================
195 void
196 extractImagesColor( PGRStereoCamera_t* stereoCamera,
197  dc1394bayer_method_t bayerMethod,
198  unsigned char* pucDeInterleaved,
199  unsigned char* pucRGB,
200  unsigned char* pucGreen,
201  unsigned char** ppucRightRGB,
202  unsigned char** ppucLeftRGB,
203  unsigned char** ppucCenterRGB,
204  TriclopsInput* pTriclopsInput );
205 
206 //=============================================================================
207 // Name: extractImagesMono
208 //
209 // Input:
210 // stereoCamera - The camera to grab from
211 //
212 // Output:
213 // pucDeInterleaved - a buffer to hold the de-interleaved bayer images
214 // size is (nrows * ncols * nimages)
215 // allocated outside this function
216 // ppucRightMono8 - a pointer to the right RGB buffer (into pucRGB)
217 // size is (nrows * ncols * 3)
218 // points into pucRGB
219 // ppucLeftMono8 - a pointer to the left RGB buffer
220 // size is (nrows * ncols * 3)
221 // points into pucRGB
222 // ppucCenterMono8 - a pointer to the center RGB buffer
223 // size is (nrows * ncols * 3)
224 // points into pucRGB
225 // This is only valid for a BB XB3
226 // pTriclopsInput - the Triclops input
227 // points into pucGreen
228 //
229 // Description:
230 // A function to extract the grab buffer from the libdc1394 camera, and to
231 // perform the required de-interleaving on the images to generate a left
232 // and right mono image and a TriclopsInput for stereo processing.
233 //=============================================================================
234 void
235 extractImagesMono( PGRStereoCamera_t* stereoCamera,
236  unsigned char* pucDeInterleaved,
237  unsigned char** ppucRightMono8,
238  unsigned char** ppucLeftMono8,
239  unsigned char** ppucCenterMono8,
240  TriclopsInput* pTriclopsInput );
241 
242 
243 //=============================================================================
244 // Name: getTriclopsContextFromCamera
245 //
246 // Input:
247 // stereoCamera - The camera to get the TriclopsContext from
248 //
249 // Output:
250 // pTriclops - The retrieved TriclopsContext
251 //
252 // Description:
253 // This function extracts the .cal calibration file from the camera, and writes
254 // it to a file in /tmp. It then loads the file back into a TriclopsContext.
255 //
256 // At the moment it is slow due to inefficient retrieval of the file from the
257 // camera.
258 //
259 // Also, the name of the file is hardcoded and is always the same. This may
260 // cause permission problems on multi-user systems. Since code is provided,
261 // however, please feel free to alter.
262 //=============================================================================
265  TriclopsContext* pTriclops );
266 
267 
268 
269 void
271  dc1394bayer_method_t bayerMethod,
272  unsigned char* pucDeInterleaved,
273  unsigned char* pucRGB,
274  unsigned char* pucGreen,
275  unsigned char** ppucRightRGB,
276  unsigned char** ppucLeftRGB,
277  unsigned char** ppucCenterRGB,
278  TriclopsInput* pShortInput,
279  TriclopsInput* pWideInput );
280 
281 void
283 
284  dc1394bayer_method_t bayerMethod,
285 
286  unsigned char* pucDeInterleaved,
287 
288  unsigned char* pucRGB,
289 
290  unsigned char* pucGreen,
291 
292  unsigned char** ppucRightRGB,
293 
294  unsigned char** ppucLeftRGB,
295 
296  unsigned char** ppucCenterRGB);
297 
298 void
300  unsigned char* pucDeInterleaved,
301  unsigned char** ppucRightMono8,
302  unsigned char** ppucLeftMono8,
303  unsigned char** ppucCenterMono8,
304  TriclopsInput* pShortInput,
305  TriclopsInput* pWideInput );
306 
307 #endif
308 
309 #if 0
310 #endif
311 
314 /*Previous 3 lines appended automatically on Wed Jun 9 00:11:56 WEST 2010 */
bool isStereoCamera(dc1394camera_t *camera)
TriclopsError getTriclopsContextFromCamera(PGRStereoCamera_t *camera, TriclopsContext *pTriclops)
PGRStereoCameraModel_t getCameraModel(dc1394camera_t *camera)
PGRStereoCameraModel_t model
Definition: pgr_stereocam.h:68
void extractImagesColor(PGRStereoCamera_t *stereoCamera, dc1394bayer_method_t bayerMethod, unsigned char *pucDeInterleaved, unsigned char *pucRGB, unsigned char *pucGreen, unsigned char **ppucRightRGB, unsigned char **ppucLeftRGB, unsigned char **ppucCenterRGB, TriclopsInput *pTriclopsInput)
dc1394error_t startTransmission(PGRStereoCamera_t *stereoCamera)
PGRStereoCameraModel_t
Definition: pgr_stereocam.h:55
dc1394camera_t * camera
Definition: pgr_stereocam.h:67
dc1394color_filter_t bayerTile
Definition: pgr_stereocam.h:69
dc1394error_t queryStereoCamera(dc1394camera_t *camera, PGRStereoCamera_t *stereoCamera)
unsigned int nBytesPerPixel
Definition: pgr_stereocam.h:73
unsigned int nCols
Definition: pgr_stereocam.h:72
void extractImagesColorXB3(PGRStereoCamera_t *stereoCamera, dc1394bayer_method_t bayerMethod, unsigned char *pucDeInterleaved, unsigned char *pucRGB, unsigned char *pucGreen, unsigned char **ppucRightRGB, unsigned char **ppucLeftRGB, unsigned char **ppucCenterRGB, TriclopsInput *pShortInput, TriclopsInput *pWideInput)
This is from point grey. Check the manual for instructions.
void * TriclopsContext
Definition: triclops.h:272
unsigned int nRows
Definition: pgr_stereocam.h:71
void extractImagesMono(PGRStereoCamera_t *stereoCamera, unsigned char *pucDeInterleaved, unsigned char **ppucRightMono8, unsigned char **ppucLeftMono8, unsigned char **ppucCenterMono8, TriclopsInput *pTriclopsInput)
dc1394error_t setStereoVideoCapture(PGRStereoCamera_t *stereoCamera)
TriclopsError
Definition: triclops.h:99
void extractImagesMonoXB3(PGRStereoCamera_t *stereoCamera, unsigned char *pucDeInterleaved, unsigned char **ppucRightMono8, unsigned char **ppucLeftMono8, unsigned char **ppucCenterMono8, TriclopsInput *pShortInput, TriclopsInput *pWideInput)


xb3
Author(s): Miguel Oliveira, Tiago Talhada
autogenerated on Mon Mar 2 2015 01:33:02