Fawkes API  Fawkes Development Version
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_right();
88  virtual unsigned char * yuv_buffer_left();
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
virtual void set_lowpass(bool enabled)
Enable or disable lowpass filtering before rectification.
Definition: triclops.cpp:313
virtual bool subpixel_interpolation()
Check state of subpixel interpolation.
Definition: triclops.cpp:397
virtual void set_surface_validation(bool enabled)
Enable or disable surface validation.
Definition: triclops.cpp:357
virtual bool get_world_xyz(unsigned int px, unsigned int py, float *x, float *y, float *z)
Get transformed coordinates of a point.
Definition: triclops.cpp:799
TriclopsStereoProcessor(unsigned int width, unsigned int height, const char *context_file)
Constructor.
Definition: triclops.cpp:124
virtual void calculate_yuv(bool both=false)
Caculate yuv images.
Definition: triclops.cpp:572
Camera interface for image aquiring devices in FireVision.
Definition: camera.h:35
virtual ~TriclopsStereoProcessor()
Destructor.
Definition: triclops.cpp:236
virtual bool edge_correlation()
Check state of edge correlation.
Definition: triclops.cpp:429
bool verify_rectification_lut(const char *lut_file)
Verify rectification LUT.
Definition: triclops.cpp:913
virtual size_t disparity_buffer_size() const
Get disparity buffer size.
Definition: triclops.cpp:675
virtual void set_texture_validation(bool enabled)
Enable or disable texture validation.
Definition: triclops.cpp:367
virtual void set_disparity_range(int min, int max)
Set disparity range.
Definition: triclops.cpp:324
virtual unsigned char disparity_mapping_max()
Get disparity mapping max value.
Definition: triclops.cpp:537
void generate_rectification_lut(const char *lut_file)
Generate rectification LUT.
Definition: triclops.cpp:859
Region of interest.
Definition: roi.h:58
virtual unsigned char * disparity_buffer()
Get the disparity image buffer.
Definition: triclops.cpp:664
virtual bool disparity_mapping()
Check state of disparity mapping.
Definition: triclops.cpp:549
virtual void set_edge_correlation(bool enabled)
Enable or disable edge correlation.
Definition: triclops.cpp:303
virtual bool lowpass()
Check state of lowpass filtering.
Definition: triclops.cpp:441
virtual unsigned int edge_masksize()
Get edge mask size.
Definition: triclops.cpp:477
virtual int disparity_range_min()
Get disparity range min value.
Definition: triclops.cpp:453
virtual void set_stereo_masksize(unsigned int mask_size)
Set stereo mask.
Definition: triclops.cpp:347
virtual unsigned char disparity_mapping_min()
Get disparity mapping min value.
Definition: triclops.cpp:525
virtual void getall_world_xyz(float ***buffer, int hoff, int voff, int width, int height, float *settings)
Calculates all three cartesian coordinates of the entire disparity map The values transformed are giv...
Definition: triclops.cpp:1012
Bumblebee2 camera.
Definition: bumblebee2.h:37
virtual unsigned char * yuv_buffer_right()
Get YUV-formatted buffer of reference camera.
Definition: triclops.cpp:693
virtual void set_edge_masksize(unsigned int mask_size)
Set edge mask.
Definition: triclops.cpp:336
virtual void set_disparity_mapping_range(unsigned char min, unsigned char max)
Set disparity mapping range.
Definition: triclops.cpp:378
virtual void set_subpixel_interpolation(bool enabled)
Enable or disable subpixel interpolation.
Definition: triclops.cpp:292
Stereo processor interface.
Stereo processing using PGR Triclops SDK.
Definition: triclops.h:40
virtual bool texture_validation()
Check state of texture validation.
Definition: triclops.cpp:513
virtual unsigned int output_image_width()
Get width of ouput images.
Definition: triclops.cpp:409
virtual bool get_xyz(unsigned int px, unsigned int py, float *x, float *y, float *z)
Get camera-relative coordinates of a point.
Definition: triclops.cpp:763
virtual unsigned int output_image_height()
Get height of ouput images.
Definition: triclops.cpp:419
virtual unsigned int stereo_masksize()
Get stereo mask size.
Definition: triclops.cpp:489
virtual void calculate_disparity(ROI *roi=0)
Caculate disparity images.
Definition: triclops.cpp:583
virtual unsigned char * yuv_buffer_left()
Get YUV-formatted buffer of left camera.
Definition: triclops.cpp:686
virtual void set_raw_buffer(unsigned char *raw16_buffer)
Set raw buffer.
Definition: triclops.cpp:265
virtual bool surface_validation()
Check state of surface validation.
Definition: triclops.cpp:501
virtual void set_output_image_size(unsigned int width, unsigned int height)
Set the resolution of the output images.
Definition: triclops.cpp:276
virtual void preprocess_stereo()
Do any pre-processing needed.
Definition: triclops.cpp:558
virtual int disparity_range_max()
Get disparity range max value.
Definition: triclops.cpp:465
virtual void set_disparity_mapping(bool enabled)
Enable or disable disparity mapping.
Definition: triclops.cpp:388