triclops.h

00001 
00002 /***************************************************************************
00003  *  triclops.h - Stereo processor using the TriclopsSDK
00004  *
00005  *  Created: Fri May 18 16:25:26 2007
00006  *  Copyright  2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISION_STEREO_TRICLOPS_H_
00025 #define __FIREVISION_STEREO_TRICLOPS_H_
00026 
00027 #include <stereo/stereo_processor.h>
00028 #include <sys/types.h>
00029 
00030 namespace firevision {
00031 #if 0 /* just to make Emacs auto-indent happy */
00032 }
00033 #endif
00034 
00035 class Bumblebee2Camera;
00036 class Camera;
00037 class TriclopsStereoProcessorData;
00038 class RectificationLutInfoBlock;
00039 
00040 class TriclopsStereoProcessor : public StereoProcessor
00041 {
00042  public:
00043   TriclopsStereoProcessor(unsigned int width, unsigned int height,
00044                           const char *context_file);
00045   TriclopsStereoProcessor(Camera *camera);
00046   virtual ~TriclopsStereoProcessor();
00047 
00048   virtual unsigned int  output_image_width();
00049   virtual unsigned int  output_image_height();
00050   virtual bool          subpixel_interpolation();
00051   virtual bool          edge_correlation();
00052   virtual bool          lowpass();
00053   virtual int           disparity_range_min();
00054   virtual int           disparity_range_max();
00055   virtual unsigned int  edge_masksize();
00056   virtual unsigned int  stereo_masksize();
00057   virtual bool          surface_validation();
00058   virtual bool          texture_validation();
00059   virtual unsigned char disparity_mapping_min();
00060   virtual unsigned char disparity_mapping_max();
00061   virtual bool          disparity_mapping();
00062 
00063   virtual void          set_output_image_size(unsigned int width, unsigned int height);
00064   virtual void          set_subpixel_interpolation(bool enabled);
00065   virtual void          set_edge_correlation(bool enabled);
00066   virtual void          set_lowpass(bool enabled);
00067   virtual void          set_disparity_range(int min, int max);
00068   virtual void          set_edge_masksize(unsigned int mask_size); // 3-13
00069   virtual void          set_stereo_masksize(unsigned int mask_size); // 1-15
00070   virtual void          set_surface_validation(bool enabled);
00071   virtual void          set_texture_validation(bool enabled);
00072   virtual void          set_disparity_mapping_range(unsigned char min, unsigned char max);
00073   virtual void          set_disparity_mapping(bool enabled);
00074 
00075   virtual bool          get_xyz(unsigned int px, unsigned int py,
00076                                 float *x, float *y, float *z);
00077 
00078   virtual bool          get_world_xyz(unsigned int px, unsigned int py,
00079                                       float *x, float *y, float *z);
00080 
00081   virtual void             set_raw_buffer(unsigned char *raw16_buffer);
00082   virtual void             preprocess_stereo();
00083   virtual void             calculate_disparity(ROI *roi = 0);
00084   virtual void             calculate_yuv(bool both = false);
00085   virtual unsigned char *  disparity_buffer();
00086   virtual size_t           disparity_buffer_size() const;
00087   virtual unsigned char *  yuv_buffer();
00088   virtual unsigned char *  auxiliary_yuv_buffer();
00089 
00090   void    generate_rectification_lut(const char *lut_file);
00091   bool    verify_rectification_lut(const char *lut_file);
00092 
00093   virtual void  getall_world_xyz(float ***buffer, int hoff, int voff, int width, int height, float *settings);
00094 
00095  private:
00096   void get_triclops_context_from_camera();
00097   void deinterlace_green( unsigned char* src, 
00098                           unsigned char* dest, 
00099                           unsigned int width, 
00100                           unsigned int height);
00101 
00102   void create_buffers();
00103   void setup_triclops();
00104 
00105 
00106  private:
00107   Bumblebee2Camera             *bb2;
00108   TriclopsStereoProcessorData  *data;
00109 
00110   unsigned char *buffer_rgb;
00111   unsigned char *buffer_green;
00112   unsigned char *buffer_rgb_left;
00113   unsigned char *buffer_rgb_right;
00114   unsigned char *buffer_rgb_center;
00115   unsigned char *buffer_yuv_left;
00116   unsigned char *buffer_yuv_right;
00117   unsigned char *buffer_yuv_center;
00118   unsigned char *_buffer;
00119   unsigned char *buffer_deinterlaced;
00120   unsigned char *buffer_raw16;
00121 
00122   unsigned int _width;
00123   unsigned int _height;
00124 
00125   unsigned int _output_image_width;
00126   unsigned int _output_image_height;
00127 
00128   char  *_context_file;
00129 };
00130 
00131 } // end namespace firevision
00132 
00133 #endif

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1