source: pacpussensors/trunk/PtGreyCameras/Flea3Grabber.h@ 58

Last change on this file since 58 was 56, checked in by phudelai, 10 years ago

Vision component updated for StereoVision for PointGrey Flea3

File size: 5.1 KB
Line 
1/*********************************************************************
2// created: 2013/10/25 - 19:36
3// filename: Flea3Grabber.h
4//
5// author: Danilo Alves de Lima
6// Copyright Heudiasyc UMR UTC/CNRS 6599
7//
8// version: $Id: $
9//
10// purpose:
11*********************************************************************/
12
13#ifndef FLEA3GRABBER_H
14#define FLEA3GRABBER_H
15
16#include <QThread>
17#include <QMutex>
18#include <QDir>
19
20#include "Pacpus/kernel/ComponentBase.h"
21#include "Pacpus/kernel/DbiteFile.h"
22#include "Pacpus/PacpusTools/ShMem.h"
23#include "PtGreyCamerasExp.h"
24
25#include "opencv2/objdetect/objdetect.hpp"
26#include "opencv2/calib3d/calib3d.hpp"
27#include "opencv2/imgproc/imgproc.hpp"
28#include "opencv2/core/core.hpp"
29#include "opencv2/highgui/highgui.hpp"
30
31#include "FlyCapture2.h"
32#include <string>
33#include <vector>
34#include "../../StdDbtPlayerComponents/ImageBaseStructure.h"
35
36namespace pacpus {
37
38typedef struct{
39 // Camera configuration
40 int cam_serial; // Camera serial to connect
41 bool auto_FrameRate; // Set auto frame rate
42 double cam_FrameRate; // Frame rates in frames per second
43 bool auto_Gain; // Set auto gain
44 double cam_Gain; // Gain value in db
45 bool auto_Exposure; // Set auto exposure
46 double cam_Exposure; // Auto exposure in EV
47 bool auto_Shutter; // Set auto shutter
48 double cam_Shutter; // Shutter in miliseconds
49 bool auto_ExposurebyCode; // Set auto exposure by pos processing method
50 double cam_ExposurebyCode_tshold; // Pecentage of white pixels for threshold
51 int cam_video_mode; // DCAM video modes
52 int cam_mode; // Camera modes for DCAM formats as well as Format7
53 int cam_PixelFormat; // Pixel formats available for Format7 modes
54 int cam_start_point_left; // Image left point (for standard modes only)
55 int cam_start_point_top; // Image top point (for standard modes only)
56 int cam_width; // Image width (for standard modes only)
57 int cam_height; // image height (for standard modes only)
58 int cam_channels; // Image channels (depending of the color processing method)
59 unsigned int cam_trigger_mode; // Trigger mode
60 unsigned int cam_trigger_enable; // Trigger enable (1 on // 0 off)
61 unsigned int cam_trigger_parameter;
62 unsigned int cam_trigger_polarity; // Trigger polarity (0 low // 1 high)
63 unsigned int cam_trigger_source; // Source (GPIO)
64 unsigned int cam_trigger_dest; // Dest (GPIO) input/output
65 unsigned int cam_strobe_source; // Strobe source
66 bool cam_strobe_enable; // Enable strobe mode
67 unsigned int cam_strobe_polarity; // Strobe polarity
68 float cam_strobe_delay;
69 float cam_strobe_duration;
70 FlyCapture2::TimeStamp timeStamp;
71 double distCoe[8];
72 cv::Mat_<double> distCoeffs;
73 double tmp_matrix[3][3];
74 cv::Mat_<double> matrix;
75 int cam_ColorProcessingAlgorithm; /**
76 * Color processing algorithms. Please refer to our knowledge base at
77 * article at http://www.ptgrey.com/support/kb/index.asp?a=4&q=33 for
78 * complete details for each algorithm.
79 */
80 //-------------------------------------------- Image save options ------------------------------------------------
81 double image_scale; // Image scale to save
82 int image_compact; // Use jpeg format to save the images
83 int save2dbt; // Save the image in the dbt file (to increases the save rate)
84
85 size_t mSaveImageSize; // Size of the image to be saved
86 //----------------------------------------------------------------------------------------------------------------
87 bool showdebug; // Show frame acquired
88
89 int mMaxImageOutputSize; // Size of the input image data in the memory
90
91 // Output directory
92 QDir mOutputDirectory;
93
94 TimestampedStructImage ImageHeader; // Image header
95 void* img_mem; // Memory position for the header + image data
96 size_t img_mem_size; // Memory size for the header + image data
97
98}camSetting;
99
100/** Class to provide the obstacle detection from a disparity map data */
101class PTGREYCAMERAS_API Flea3Grabber: public QThread,
102 public ComponentBase
103{
104public:
105 //============================= DEFAULT ELEMENTS ===============================================
106 Flea3Grabber(QString name);
107 ~Flea3Grabber();
108
109 void run();
110
111 virtual void stopActivity(); /*!< to stop the processing thread */
112 virtual void startActivity(); /*!< to start the processing thread */
113 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
114 //==============================================================================================
115
116protected:
117
118 // Indicates that thread is running
119 bool is_running;
120 DbiteFile mDbtImage;
121 bool use_shmem; // If is to use shared memory
122 bool shmem_corrected;
123 bool THREAD_ALIVE;
124
125public:
126
127 /**
128 * Initialize default values
129 */
130 void InitDefault(int indice);
131
132private:
133 int nbrCamera_;
134 int masterCamera_;
135 float rot_[3], trans_[3];
136
137 ShMem * img_sending_;
138
139 std::vector<camSetting> settings_;
140 std::vector<ShMem*> shmem_images_;
141};
142
143}
144#endif // FLEA3GRABBER
Note: See TracBrowser for help on using the repository browser.