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

Last change on this file since 140 was 99, checked in by nguyenhu, 9 years ago

compilation under linux with 0.2.X framework

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