00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00032 //============================================================================= 00033 // Copyright © 2004 Point Grey Research, Inc. All Rights Reserved. 00034 // 00035 // This software is the confidential and proprietary information of Point 00036 // Grey Research, Inc. ("Confidential Information"). You shall not 00037 // disclose such Confidential Information and shall use it only in 00038 // accordance with the terms of the license agreement you entered into 00039 // with Point Grey Research, Inc. (PGR). 00040 // 00041 // PGR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE 00042 // SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 00043 // IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 00044 // PURPOSE, OR NON-INFRINGEMENT. PGR SHALL NOT BE LIABLE FOR ANY DAMAGES 00045 // SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING 00046 // THIS SOFTWARE OR ITS DERIVATIVES. 00047 // 00048 //============================================================================= 00049 //============================================================================= 00050 // $Id: triclopscontext.h,v 2.6 2010/06/24 22:04:18 arturp Exp $ 00051 //============================================================================= 00052 #ifndef TRICLOPSCONTEXT_H 00053 #define TRICLOPSCONTEXT_H 00054 00055 //============================================================================= 00056 // 00057 // This file defines the the API for TriclopsContext management functions 00058 // within the Triclops Stereo Vision SDK. 00059 // 00060 //============================================================================= 00061 00062 00063 //============================================================================= 00064 // Defines 00065 //============================================================================= 00066 00067 //============================================================================= 00068 // System Includes 00069 //============================================================================= 00070 00071 #include <triclops.h> 00072 00073 #ifdef __cplusplus 00074 extern "C" 00075 { 00076 #endif 00077 00078 //============================================================================= 00079 // Macros 00080 //============================================================================= 00081 00082 00083 //============================================================================= 00084 // Enumerations 00085 //============================================================================= 00086 // 00087 // Group = Enumerations 00088 00089 // 00090 // Name: TriclopsCameraConfiguration 00091 // 00092 // Description: 00093 // This enumerated type defines the camera configuration. The symbols in 00094 // the table represent the cameras as they would be seen when the camera 00095 // module is viewed from the front. This type is either read from the camera 00096 // or is set manually to indicate 2-Camera mode. 00097 // 00098 typedef enum TriclopsCameraConfiguration 00099 { 00100 // L shaped three camera system ** obsolete **. 00101 TriCfg_L = 0, 00102 // 2 Camera Unit or 3 Camera Unit in 2 camera stereo mode. 00103 TriCfg_2CAM_HORIZONTAL = 1, 00104 TriCfg_2CAM_HORIZONTAL_NARROW = 1, // 12cm baseline for BB2 or XB3 00105 // 2 Camera Vertical Unit or 3 Camera Unit in 2 camera vertical mode. 00106 TriCfg_2CAM_VERTICAL = 2, 00107 TriCfg_2CAM_HORIZONTAL_WIDE = 3, // 24cm baseline for XB3 00108 TriCfg_MAX_VALUE = 3 00109 00110 } TriclopsCameraConfiguration; 00111 00112 00113 //============================================================================= 00114 // Types 00115 //============================================================================= 00116 00117 //============================================================================= 00118 // Function Prototypes 00119 //============================================================================= 00120 00121 //============================================================================= 00122 // Triclops Context Manipulation 00123 //============================================================================= 00124 // 00125 //Group = Triclops Context Manipulation 00126 00127 // 00128 // Name: triclopsGetDefaultContextFromFile 00129 // 00130 // Synopsis: 00131 // Setup the initial context with data obtained from a file. 00132 // 00133 // Input: 00134 // filename - The configuration file name. 00135 // 00136 // Output: 00137 // defaultContext - The default context. 00138 // 00139 // Returns: 00140 // TriclopsErrorOk - The operation succeeded. 00141 // CorruptConfigFile - The specified file was corrupt, or was for the 00142 // wrong Triclops version. 00143 // 00144 // Description: 00145 // This function reads in the default option list and the camera 00146 // calibration data from a file. If the specified file is not found, 00147 // contains invalid fields, or is for the wrong product, the value of 00148 // CorruptConfigFile will be returned. 00149 // 00150 // See Also: 00151 // triclopsWriteDefaultContextToFile(), triclopsWriteCurrentContextToFile() 00152 // 00153 TriclopsError 00154 triclopsGetDefaultContextFromFile( TriclopsContext* defaultContext, 00155 char* filename ); 00156 00157 // 00158 // Name: triclopsWriteDefaultContextToFile 00159 // 00160 // Synopsis: 00161 // This writes the default calibration file from the TriclopsContext 00162 // to a file. 00163 // 00164 // Input: 00165 // context - The TriclopsContext 00166 // filename - The name of the file to be written 00167 // 00168 // Output: 00169 // none 00170 // 00171 // Returns: 00172 // TriclopsErrorOk - The operation succeeded. 00173 // InvalidContext - The context provided was invalid 00174 // SystemError - Could not open the specified file 00175 // 00176 // Description: 00177 // This function writes the default context parameters and calibration 00178 // data to a file. It does not write the current configuration, rather the 00179 // original configuration that would obtained when getting the default 00180 // from either a file or a device. 00181 // 00182 // See Also: 00183 // TriclopsGetDefaultContextFromFile(), triclopsWriteCurrentContextToFile() 00184 // 00185 TriclopsError 00186 triclopsWriteDefaultContextToFile( TriclopsContext context, 00187 char* filename ); 00188 00189 00190 // 00191 // Name: triclopsWriteCurrentContextToFile 00192 // 00193 // Synopsis: 00194 // This writes the calibration and parameter file from the TriclopsContext 00195 // to a file. It is the "current" context, so it uses the parameters 00196 // that are currently active in the TriclopsContext. Any parameter changes 00197 // that have been made through the API will be reflected in this 00198 // calibration file. 00199 // 00200 // Input: 00201 // context - The TriclopsContext 00202 // filename - The name of the file to be written 00203 // 00204 // Output: 00205 // none 00206 // 00207 // Returns: 00208 // TriclopsErrorOk - The operation succeeded. 00209 // InvalidContext - The context provided was invalid 00210 // SystemError - Could not open the specified file 00211 // 00212 // Description: 00213 // This function writes the current context parameters and calibration 00214 // data to a file. 00215 // 00216 // See Also: 00217 // TriclopsGetDefaultContextFromFile(), triclopsWriteDefaultContextToFile() 00218 // 00219 TriclopsError 00220 triclopsWriteCurrentContextToFile( TriclopsContext context, 00221 char* filename ); 00222 00223 00224 // 00225 // Name: triclopsCopyContext 00226 // 00227 // Synopsis: 00228 // Copies the context parameters and images. Care must be taken when 00229 // using triclopsCopyContext() as contexts will share image buffers. 00230 // 00231 // Input: 00232 // contextIn - A context that has already been constructed. 00233 // 00234 // Output: 00235 // contextOut - A copy of the input context. 00236 // 00237 // Returns: 00238 // TriclopsErrorOk - The operation succeeded. 00239 // InvalidContext - The input context is invalid. 00240 // 00241 // Description: 00242 // This function creates a copy of the input context. This allows 00243 // the user to have two contexts with the same options and also to 00244 // share the same image buffers. Care must be taken with this function. 00245 // The ensuing contexts will share image buffers. This allows them to 00246 // share some of the previous processing, however, any changes in resolution 00247 // or calls to set image buffers will create new buffers to be used. These 00248 // buffers will no longer be shared and thus programs may not operate as 00249 // expected at this time. The recommendation is to use this operation when 00250 // one wants to run stereo with different stereo options. After the 00251 // preprocessing step, the context can be copied and different stereo options 00252 // set before the call to triclopsStereo(). 00253 // 00254 // Note: This only copies the options, not the images 00255 // 00256 // See Also: 00257 // triclopsGetDefaultContext(), triclopsDestroyContext() 00258 // 00259 TriclopsError 00260 triclopsCopyContext( const TriclopsContext contextIn, 00261 TriclopsContext* contextOut ); 00262 00263 // 00264 // Name: triclopsDestroyContext 00265 // 00266 // Synopsis: 00267 // Destroys the given context. 00268 // 00269 // Input: 00270 // Context - The context to be destroyed. 00271 // 00272 // Returns: 00273 // TriclopsErrorOk - The operation succeeded. 00274 // InvalidContext - The context was invalid. 00275 // 00276 // Description: 00277 // This function destroys a context and frees all associated memory. 00278 // 00279 TriclopsError 00280 triclopsDestroyContext( TriclopsContext context ); 00281 00282 //============================================================================= 00283 // Configuration 00284 //============================================================================= 00285 // 00286 // Group = Configuration 00287 00288 // 00289 // Name: triclopsGetCameraConfiguration 00290 // 00291 // Synopsis: 00292 // Retrieves the current configuration of the stereo camera. This 00293 // configuration is the configuration that specifies the stereo 00294 // algorithm used. For example, 2CAM_HORIZONTAL configuration can be 00295 // used to do 2 camera stereo on a 3 camera device. 00296 // 00297 // Input: 00298 // context - The context. 00299 // 00300 // Output: 00301 // config - A pointer that will hold the result. 00302 // 00303 // Returns: 00304 // TriclopsErrorOk - The operation succeeded. 00305 // InvalidContext - The input context was invalid. 00306 // 00307 // See Also: 00308 // TriclopsCameraConfiguration, TriclopsSetCameraConfiguration(), 00309 // TriclopsGetDeviceConfiguration() 00310 // 00311 TriclopsError 00312 triclopsGetCameraConfiguration( const TriclopsContext context, 00313 TriclopsCameraConfiguration* config ); 00314 00315 // 00316 // Name: triclopsSetCameraConfiguration 00317 // 00318 // Synopsis: 00319 // Sets the configuration of the cameras. This configuration determines 00320 // the configuration for the stereo algorithm. For example, a three camera 00321 // stereo device may be set into "2 camera horizontal" mode for faster 00322 // stereo processing. 00323 // 00324 // Input: 00325 // context - The context. 00326 // config - The new CameraConfiguration. 00327 // 00328 // Returns: 00329 // TriclopsErrorOk - The operation succeeded. 00330 // InvalidContext - The input context was invalid. 00331 // InvalidParameter - 'config' is not a valid camera configuration 00332 // 00333 // See Also: 00334 // TriclopsCameraConfiguration, TriclopsGetCameraConfiguration(), 00335 // TriclopsGetDeviceConfiguration() 00336 // 00337 TriclopsError 00338 triclopsSetCameraConfiguration( const TriclopsContext context, 00339 TriclopsCameraConfiguration config ); 00340 00341 // 00342 // Name: triclopsGetDeviceConfiguration 00343 // 00344 // Synopsis: 00345 // This function returns the physical configuration of the stereo device. 00346 // This allows the user to determine what algorithms they have available 00347 // on the current device. 00348 // 00349 // Input: 00350 // context - The context. 00351 // 00352 // Output: 00353 // config - The physical CameraConfiguration. 00354 // 00355 // Returns: 00356 // TriclopsErrorOk - The operation succeeded. 00357 // InvalidContext - The input context was invalid. 00358 // 00359 // See Also: 00360 // TriclopsCameraConfiguration, TriclopsGetCameraConfiguration(), 00361 // TriclopsSetCameraConfiguration() 00362 // 00363 TriclopsError 00364 triclopsGetDeviceConfiguration( const TriclopsContext context, 00365 TriclopsCameraConfiguration* config ); 00366 00367 // 00368 // Name: triclopsGetSerialNumber 00369 // 00370 // Description: 00371 // This function returns the serial number of the stereo camera 00372 // product associated with the given TriclopsContext. 00373 // 00374 // Input: 00375 // context - The context to extract the serial number from. 00376 // 00377 // Output: 00378 // serialNumber - The serial number of the stereo camera product 00379 // associated with the given context. 00380 // 00381 // Returns: 00382 // TriclopsErrorOk - Upon the successful completion of the operation. 00383 // 00384 TriclopsError 00385 triclopsGetSerialNumber( const TriclopsContext context, 00386 int* serialNumber ); 00387 00388 #ifdef __cplusplus 00389 } 00390 #endif 00391 00392 #endif // #ifndef TRICLOPSCONTEXT_H