[51] | 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 "FlyCapture2.h"
|
---|
| 26 | #include <string>
|
---|
| 27 | #include <vector>
|
---|
| 28 | #include "../../StdDbtPlayerComponents/ImageBaseStructure.h"
|
---|
| 29 |
|
---|
| 30 | namespace pacpus {
|
---|
| 31 |
|
---|
| 32 | typedef struct{
|
---|
| 33 | // Camera configuration
|
---|
| 34 | int cam_serial; // Camera serial to connect
|
---|
| 35 | bool auto_FrameRate; // Set auto frame rate
|
---|
| 36 | double cam_FrameRate; // Frame rates in frames per second
|
---|
| 37 | bool auto_Gain; // Set auto gain
|
---|
| 38 | double cam_Gain; // Gain value in db
|
---|
| 39 | bool auto_Exposure; // Set auto exposure
|
---|
| 40 | double cam_Exposure; // Auto exposure in EV
|
---|
| 41 | bool auto_Shutter; // Set auto shutter
|
---|
| 42 | double cam_Shutter; // Shutter in miliseconds
|
---|
| 43 | bool auto_ExposurebyCode; // Set auto exposure by pos processing method
|
---|
| 44 | double cam_ExposurebyCode_tshold; // Pecentage of white pixels for threshold
|
---|
| 45 | int cam_video_mode; // DCAM video modes
|
---|
| 46 | int cam_mode; // Camera modes for DCAM formats as well as Format7
|
---|
| 47 | int cam_PixelFormat; // Pixel formats available for Format7 modes
|
---|
| 48 | int cam_start_point_left; // Image left point (for standard modes only)
|
---|
| 49 | int cam_start_point_top; // Image top point (for standard modes only)
|
---|
| 50 | int cam_width; // Image width (for standard modes only)
|
---|
| 51 | int cam_height; // image height (for standard modes only)
|
---|
| 52 | int cam_channels; // Image channels (depending of the color processing method)
|
---|
| 53 | unsigned int cam_trigger_mode; // Trigger mode
|
---|
| 54 | unsigned int cam_trigger_enable; // Trigger enable (1 on // 0 off)
|
---|
| 55 | unsigned int cam_trigger_parameter;
|
---|
| 56 | unsigned int cam_trigger_polarity; // Trigger polarity (0 low // 1 high)
|
---|
| 57 | unsigned int cam_trigger_source; // Source (GPIO)
|
---|
| 58 | unsigned int cam_trigger_dest; // Dest (GPIO) input/output
|
---|
| 59 | unsigned int cam_strobe_source; // Strobe source
|
---|
| 60 | bool cam_strobe_enable; // Enable strobe mode
|
---|
| 61 | unsigned int cam_strobe_polarity; // Strobe polarity
|
---|
| 62 | float cam_strobe_delay;
|
---|
| 63 | float cam_strobe_duration;
|
---|
| 64 |
|
---|
| 65 | int cam_ColorProcessingAlgorithm; /**
|
---|
| 66 | * Color processing algorithms. Please refer to our knowledge base at
|
---|
| 67 | * article at http://www.ptgrey.com/support/kb/index.asp?a=4&q=33 for
|
---|
| 68 | * complete details for each algorithm.
|
---|
| 69 | */
|
---|
| 70 | //-------------------------------------------- Image save options ------------------------------------------------
|
---|
| 71 | double image_scale; // Image scale to save
|
---|
| 72 | int image_compact; // Use jpeg format to save the images
|
---|
| 73 | int save2dbt; // Save the image in the dbt file (to increases the save rate)
|
---|
| 74 |
|
---|
| 75 | size_t mSaveImageSize; // Size of the image to be saved
|
---|
| 76 | //----------------------------------------------------------------------------------------------------------------
|
---|
| 77 | bool showdebug; // Show frame acquired
|
---|
| 78 |
|
---|
| 79 | int mMaxImageOutputSize; // Size of the input image data in the memory
|
---|
| 80 |
|
---|
| 81 | // Output directory
|
---|
| 82 | QDir mOutputDirectory;
|
---|
| 83 |
|
---|
| 84 | TimestampedStructImage ImageHeader; // Image header
|
---|
| 85 | void* img_mem; // Memory position for the header + image data
|
---|
| 86 | size_t img_mem_size; // Memory size for the header + image data
|
---|
| 87 |
|
---|
| 88 | }camSetting;
|
---|
| 89 |
|
---|
| 90 | /** Class to provide the obstacle detection from a disparity map data */
|
---|
| 91 | class PTGREYCAMERAS_API Flea3Grabber: public QThread,
|
---|
| 92 | public ComponentBase
|
---|
| 93 | {
|
---|
| 94 | public:
|
---|
| 95 | //============================= DEFAULT ELEMENTS ===============================================
|
---|
| 96 | Flea3Grabber(QString name);
|
---|
| 97 | ~Flea3Grabber();
|
---|
| 98 |
|
---|
| 99 | void run();
|
---|
| 100 |
|
---|
| 101 | virtual void stopActivity(); /*!< to stop the processing thread */
|
---|
| 102 | virtual void startActivity(); /*!< to start the processing thread */
|
---|
| 103 | virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
|
---|
| 104 | //==============================================================================================
|
---|
| 105 |
|
---|
| 106 | protected:
|
---|
| 107 |
|
---|
| 108 | // Indicates that thread is running
|
---|
| 109 | bool is_running;
|
---|
| 110 | DbiteFile mDbtImage;
|
---|
| 111 | bool use_shmem; // If is to use shared memory
|
---|
| 112 | bool THREAD_ALIVE;
|
---|
| 113 |
|
---|
| 114 | public:
|
---|
| 115 |
|
---|
| 116 | /**
|
---|
| 117 | * Initialize default values
|
---|
| 118 | */
|
---|
| 119 | void InitDefault(int indice);
|
---|
| 120 |
|
---|
| 121 | private:
|
---|
| 122 | int nbrCamera_;
|
---|
| 123 | int masterCamera_;
|
---|
| 124 |
|
---|
| 125 | std::vector<camSetting> settings_;
|
---|
| 126 | std::vector<ShMem*> shmem_images_;
|
---|
| 127 | };
|
---|
| 128 |
|
---|
| 129 | }
|
---|
| 130 | #endif // FLEA3GRABBER
|
---|