Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
triclops.h
1 
2 /***************************************************************************
3  * triclops.h - Stereo processor using the TriclopsSDK
4  *
5  * Created: Fri May 18 16:25:26 2007
6  * Copyright 2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_STEREO_TRICLOPS_H_
25 #define __FIREVISION_STEREO_TRICLOPS_H_
26 
27 #include <fvstereo/stereo_processor.h>
28 #include <sys/types.h>
29 
30 namespace firevision {
31 #if 0 /* just to make Emacs auto-indent happy */
32 }
33 #endif
34 
35 class Bumblebee2Camera;
36 class Camera;
37 class TriclopsStereoProcessorData;
38 class RectificationLutInfoBlock;
39 
41 {
42  public:
43  TriclopsStereoProcessor(unsigned int width, unsigned int height,
44  const char *context_file);
46  virtual ~TriclopsStereoProcessor();
47 
48  virtual unsigned int output_image_width();
49  virtual unsigned int output_image_height();
50  virtual bool subpixel_interpolation();
51  virtual bool edge_correlation();
52  virtual bool lowpass();
53  virtual int disparity_range_min();
54  virtual int disparity_range_max();
55  virtual unsigned int edge_masksize();
56  virtual unsigned int stereo_masksize();
57  virtual bool surface_validation();
58  virtual bool texture_validation();
59  virtual unsigned char disparity_mapping_min();
60  virtual unsigned char disparity_mapping_max();
61  virtual bool disparity_mapping();
62 
63  virtual void set_output_image_size(unsigned int width, unsigned int height);
64  virtual void set_subpixel_interpolation(bool enabled);
65  virtual void set_edge_correlation(bool enabled);
66  virtual void set_lowpass(bool enabled);
67  virtual void set_disparity_range(int min, int max);
68  virtual void set_edge_masksize(unsigned int mask_size); // 3-13
69  virtual void set_stereo_masksize(unsigned int mask_size); // 1-15
70  virtual void set_surface_validation(bool enabled);
71  virtual void set_texture_validation(bool enabled);
72  virtual void set_disparity_mapping_range(unsigned char min, unsigned char max);
73  virtual void set_disparity_mapping(bool enabled);
74 
75  virtual bool get_xyz(unsigned int px, unsigned int py,
76  float *x, float *y, float *z);
77 
78  virtual bool get_world_xyz(unsigned int px, unsigned int py,
79  float *x, float *y, float *z);
80 
81  virtual void set_raw_buffer(unsigned char *raw16_buffer);
82  virtual void preprocess_stereo();
83  virtual void calculate_disparity(ROI *roi = 0);
84  virtual void calculate_yuv(bool both = false);
85  virtual unsigned char * disparity_buffer();
86  virtual size_t disparity_buffer_size() const;
87  virtual unsigned char * yuv_buffer();
88  virtual unsigned char * auxiliary_yuv_buffer();
89 
90  void generate_rectification_lut(const char *lut_file);
91  bool verify_rectification_lut(const char *lut_file);
92 
93  virtual void getall_world_xyz(float ***buffer, int hoff, int voff, int width, int height, float *settings);
94 
95  private:
96  void get_triclops_context_from_camera();
97  void deinterlace_green( unsigned char* src,
98  unsigned char* dest,
99  unsigned int width,
100  unsigned int height);
101 
102  void create_buffers();
103  void setup_triclops();
104 
105 
106  private:
107  Bumblebee2Camera *bb2;
108  TriclopsStereoProcessorData *data;
109 
110  unsigned char *buffer_rgb;
111  unsigned char *buffer_green;
112  unsigned char *buffer_rgb_left;
113  unsigned char *buffer_rgb_right;
114  unsigned char *buffer_rgb_center;
115  unsigned char *buffer_yuv_left;
116  unsigned char *buffer_yuv_right;
117  unsigned char *buffer_yuv_center;
118  unsigned char *_buffer;
119  unsigned char *buffer_deinterlaced;
120  unsigned char *buffer_raw16;
121 
122  unsigned int _width;
123  unsigned int _height;
124 
125  unsigned int _output_image_width;
126  unsigned int _output_image_height;
127 
128  char *_context_file;
129 };
130 
131 } // end namespace firevision
132 
133 #endif