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 
32 class Bumblebee2Camera;
33 class Camera;
34 class TriclopsStereoProcessorData;
35 class RectificationLutInfoBlock;
36 
38 {
39 public:
40  TriclopsStereoProcessor(unsigned int width, unsigned int height, const char *context_file);
42  virtual ~TriclopsStereoProcessor();
43 
44  virtual unsigned int output_image_width();
45  virtual unsigned int output_image_height();
46  virtual bool subpixel_interpolation();
47  virtual bool edge_correlation();
48  virtual bool lowpass();
49  virtual int disparity_range_min();
50  virtual int disparity_range_max();
51  virtual unsigned int edge_masksize();
52  virtual unsigned int stereo_masksize();
53  virtual bool surface_validation();
54  virtual bool texture_validation();
55  virtual unsigned char disparity_mapping_min();
56  virtual unsigned char disparity_mapping_max();
57  virtual bool disparity_mapping();
58 
59  virtual void set_output_image_size(unsigned int width, unsigned int height);
60  virtual void set_subpixel_interpolation(bool enabled);
61  virtual void set_edge_correlation(bool enabled);
62  virtual void set_lowpass(bool enabled);
63  virtual void set_disparity_range(int min, int max);
64  virtual void set_edge_masksize(unsigned int mask_size); // 3-13
65  virtual void set_stereo_masksize(unsigned int mask_size); // 1-15
66  virtual void set_surface_validation(bool enabled);
67  virtual void set_texture_validation(bool enabled);
68  virtual void set_disparity_mapping_range(unsigned char min, unsigned char max);
69  virtual void set_disparity_mapping(bool enabled);
70 
71  virtual bool get_xyz(unsigned int px, unsigned int py, float *x, float *y, float *z);
72 
73  virtual bool get_world_xyz(unsigned int px, unsigned int py, float *x, float *y, float *z);
74 
75  virtual void set_raw_buffer(unsigned char *raw16_buffer);
76  virtual void preprocess_stereo();
77  virtual void calculate_disparity(ROI *roi = 0);
78  virtual void calculate_yuv(bool both = false);
79  virtual unsigned char *disparity_buffer();
80  virtual size_t disparity_buffer_size() const;
81  virtual unsigned char *yuv_buffer_right();
82  virtual unsigned char *yuv_buffer_left();
83 
84  void generate_rectification_lut(const char *lut_file);
85  bool verify_rectification_lut(const char *lut_file);
86 
87  virtual void
88  getall_world_xyz(float ***buffer, int hoff, int voff, int width, int height, float *settings);
89 
90 private:
91  void get_triclops_context_from_camera();
92  void deinterlace_green(unsigned char *src,
93  unsigned char *dest,
94  unsigned int width,
95  unsigned int height);
96 
97  void create_buffers();
98  void setup_triclops();
99 
100 private:
101  Bumblebee2Camera * bb2;
102  TriclopsStereoProcessorData *data;
103 
104  unsigned char *buffer_rgb;
105  unsigned char *buffer_green;
106  unsigned char *buffer_rgb_left;
107  unsigned char *buffer_rgb_right;
108  unsigned char *buffer_rgb_center;
109  unsigned char *buffer_yuv_left;
110  unsigned char *buffer_yuv_right;
111  unsigned char *buffer_yuv_center;
112  unsigned char *_buffer;
113  unsigned char *buffer_deinterlaced;
114  unsigned char *buffer_raw16;
115 
116  unsigned int _width;
117  unsigned int _height;
118 
119  unsigned int _output_image_width;
120  unsigned int _output_image_height;
121 
122  char *_context_file;
123 };
124 
125 } // end namespace firevision
126 
127 #endif
firevision::TriclopsStereoProcessor::lowpass
virtual bool lowpass()
Check state of lowpass filtering.
Definition: triclops.cpp:416
firevision::TriclopsStereoProcessor::disparity_mapping
virtual bool disparity_mapping()
Check state of disparity mapping.
Definition: triclops.cpp:515
firevision::TriclopsStereoProcessor::set_texture_validation
virtual void set_texture_validation(bool enabled)
Enable or disable texture validation.
Definition: triclops.cpp:348
firevision::TriclopsStereoProcessor::verify_rectification_lut
bool verify_rectification_lut(const char *lut_file)
Verify rectification LUT.
Definition: triclops.cpp:876
firevision::TriclopsStereoProcessor
Stereo processing using PGR Triclops SDK.
Definition: triclops.h:38
firevision::StereoProcessor
Stereo processor interface.
Definition: stereo_processor.h:34
firevision::TriclopsStereoProcessor::disparity_range_min
virtual int disparity_range_min()
Get disparity range min value.
Definition: triclops.cpp:427
firevision::TriclopsStereoProcessor::~TriclopsStereoProcessor
virtual ~TriclopsStereoProcessor()
Destructor.
Definition: triclops.cpp:222
firevision::TriclopsStereoProcessor::generate_rectification_lut
void generate_rectification_lut(const char *lut_file)
Generate rectification LUT.
Definition: triclops.cpp:821
firevision::TriclopsStereoProcessor::getall_world_xyz
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:977
firevision::ROI
Region of interest.
Definition: roi.h:55
firevision::TriclopsStereoProcessor::calculate_yuv
virtual void calculate_yuv(bool both=false)
Caculate yuv images.
Definition: triclops.cpp:536
firevision::TriclopsStereoProcessor::get_world_xyz
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:758
firevision::TriclopsStereoProcessor::output_image_width
virtual unsigned int output_image_width()
Get width of ouput images.
Definition: triclops.cpp:387
firevision::TriclopsStereoProcessor::set_disparity_mapping
virtual void set_disparity_mapping(bool enabled)
Enable or disable disparity mapping.
Definition: triclops.cpp:367
firevision::TriclopsStereoProcessor::set_edge_correlation
virtual void set_edge_correlation(bool enabled)
Enable or disable edge correlation.
Definition: triclops.cpp:290
firevision::TriclopsStereoProcessor::disparity_buffer_size
virtual size_t disparity_buffer_size() const
Get disparity buffer size.
Definition: triclops.cpp:642
firevision::TriclopsStereoProcessor::set_raw_buffer
virtual void set_raw_buffer(unsigned char *raw16_buffer)
Set raw buffer.
Definition: triclops.cpp:256
firevision::TriclopsStereoProcessor::set_output_image_size
virtual void set_output_image_size(unsigned int width, unsigned int height)
Set the resolution of the output images.
Definition: triclops.cpp:266
firevision::TriclopsStereoProcessor::disparity_range_max
virtual int disparity_range_max()
Get disparity range max value.
Definition: triclops.cpp:438
firevision::TriclopsStereoProcessor::TriclopsStereoProcessor
TriclopsStereoProcessor(unsigned int width, unsigned int height, const char *context_file)
Constructor.
Definition: triclops.cpp:116
firevision::TriclopsStereoProcessor::set_lowpass
virtual void set_lowpass(bool enabled)
Enable or disable lowpass filtering before rectification.
Definition: triclops.cpp:299
firevision::TriclopsStereoProcessor::disparity_buffer
virtual unsigned char * disparity_buffer()
Get the disparity image buffer.
Definition: triclops.cpp:632
firevision::TriclopsStereoProcessor::preprocess_stereo
virtual void preprocess_stereo()
Do any pre-processing needed.
Definition: triclops.cpp:523
firevision::TriclopsStereoProcessor::get_xyz
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:723
firevision::Bumblebee2Camera
Bumblebee2 camera.
Definition: bumblebee2.h:35
firevision::TriclopsStereoProcessor::set_disparity_mapping_range
virtual void set_disparity_mapping_range(unsigned char min, unsigned char max)
Set disparity mapping range.
Definition: triclops.cpp:358
firevision::TriclopsStereoProcessor::set_disparity_range
virtual void set_disparity_range(int min, int max)
Set disparity range.
Definition: triclops.cpp:309
firevision::TriclopsStereoProcessor::disparity_mapping_max
virtual unsigned char disparity_mapping_max()
Get disparity mapping max value.
Definition: triclops.cpp:504
firevision::TriclopsStereoProcessor::edge_masksize
virtual unsigned int edge_masksize()
Get edge mask size.
Definition: triclops.cpp:449
firevision::TriclopsStereoProcessor::set_stereo_masksize
virtual void set_stereo_masksize(unsigned int mask_size)
Set stereo mask.
Definition: triclops.cpp:330
firevision::TriclopsStereoProcessor::edge_correlation
virtual bool edge_correlation()
Check state of edge correlation.
Definition: triclops.cpp:405
firevision::TriclopsStereoProcessor::texture_validation
virtual bool texture_validation()
Check state of texture validation.
Definition: triclops.cpp:482
firevision::TriclopsStereoProcessor::set_edge_masksize
virtual void set_edge_masksize(unsigned int mask_size)
Set edge mask.
Definition: triclops.cpp:320
firevision::TriclopsStereoProcessor::yuv_buffer_left
virtual unsigned char * yuv_buffer_left()
Get YUV-formatted buffer of left camera.
Definition: triclops.cpp:652
firevision::TriclopsStereoProcessor::disparity_mapping_min
virtual unsigned char disparity_mapping_min()
Get disparity mapping min value.
Definition: triclops.cpp:493
firevision::TriclopsStereoProcessor::output_image_height
virtual unsigned int output_image_height()
Get height of ouput images.
Definition: triclops.cpp:396
firevision::Camera
Camera interface for image aquiring devices in FireVision.
Definition: camera.h:33
firevision::TriclopsStereoProcessor::set_surface_validation
virtual void set_surface_validation(bool enabled)
Enable or disable surface validation.
Definition: triclops.cpp:339
firevision::TriclopsStereoProcessor::subpixel_interpolation
virtual bool subpixel_interpolation()
Check state of subpixel interpolation.
Definition: triclops.cpp:376
firevision::TriclopsStereoProcessor::set_subpixel_interpolation
virtual void set_subpixel_interpolation(bool enabled)
Enable or disable subpixel interpolation.
Definition: triclops.cpp:280
firevision::TriclopsStereoProcessor::calculate_disparity
virtual void calculate_disparity(ROI *roi=0)
Caculate disparity images.
Definition: triclops.cpp:546
firevision::TriclopsStereoProcessor::yuv_buffer_right
virtual unsigned char * yuv_buffer_right()
Get YUV-formatted buffer of reference camera.
Definition: triclops.cpp:658
firevision::TriclopsStereoProcessor::stereo_masksize
virtual unsigned int stereo_masksize()
Get stereo mask size.
Definition: triclops.cpp:460
firevision::TriclopsStereoProcessor::surface_validation
virtual bool surface_validation()
Check state of surface validation.
Definition: triclops.cpp:471