source: pacpusframework/branches/2.0-beta1/include/PacpusCityVIP/Video/sensor/Camera1394.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 4.6 KB
Line 
1/*********************************************************************
2// created: 2006/06/08 - 21:45
3// filename: Camera1394.h
4//
5// author: Gerald Dherbomez
6//
7// version: $Id: Camera1394.h 1199 2012-08-01 08:51:24Z kurdejma $
8//
9// purpose: Interface with the CMU driver
10//
11//
12// Below are the format, mode and framerate supported by the driver:
13//
14// -----------------------------------------
15// Format Mode Image Size Color Format
16// -----------------------------------------
17// 0 0 160x120 YUV(4:4:4)
18// 1 320x240 YUV(4:2:2)
19// 2 640x480 YUV(4:1:1)
20// 3 640x480 YUV(4:2:2)
21// 4 640x480 RGB
22// 5 640x480 Mono (8-bit)
23// 6 640x480 Mono (16-bit)
24// -----------------------------------------
25// 1 0 800x600 YUV(4:2:2)
26// 1 800x600 RGB
27// 2 800x600 Mono (8-bit)
28// 3 1024x768 YUV(4:2:2)
29// 4 1024x768 RGB
30// 5 1024x768 Mono (8-bit)
31// 6 800x600 Mono (16-bit)
32// 7 1024x768 Mono (16-bit)
33// -----------------------------------------
34// 2 0 1280x960 YUV(4:2:2)
35// 1 1280x960 RGB
36// 2 1280x960 Mono (8-bit)
37// 3 1600x1200 YUV(4:2:2)
38// 4 1600x1200 RGB
39// 5 1600x1200 Mono (8-bit)
40// 6 1280x960 Mono (16-bit)
41// 7 1600x1200 Mono (16-bit)
42// -----------------------------------------
43// 7 0-7 Partial Scan Selectable
44// -----------------------------------------
45//
46//
47// ------------------
48// Code Rate (fps)
49// ------------------
50// 0 1.875
51// 1 3.75
52// 2 7.5
53// 3 15
54// 4 30
55// 5 60
56// ------------------
57//
58//
59*********************************************************************/
60
61#ifndef _CAMERA1394_H_
62#define _CAMERA1394_H_
63
64//# include "../../include/VisualMemoryManager/struct.h"
65
66#include <qthread.h>
67#include <qimage.h>
68#include <qmutex.h>
69
70#include "kernel/ComponentBase.h"
71#include "kernel/DbiteFile.h"
72#include "../DbtPlyPluginVision/ImageViewer.h"
73
74#ifdef WIN32
75# include <windows.h>
76# include "C1394Camera/1394Camera.h"
77#endif
78
79namespace pacpus {
80
81#define MAX_CHAR_PICTURE_NAME 64
82#define MAX_CHAR_DIRECTORY_NAME 64
83
84class Camera1394
85 : public QThread
86 , public ComponentBase
87{
88 Q_OBJECT
89
90public:
91 Camera1394(QString name);
92 ~Camera1394();
93 void run();
94
95 bool fillRGB32Image(unsigned char * buffer);
96 void YUV444toRGB32(unsigned char* buffer);
97 void YUV422toRGB32(unsigned char *buffer);
98 void YUV411toRGB32(unsigned char* buffer);
99 void YtoRGB32(unsigned char * buffer);
100 void Y16toRGB32(unsigned char * buffer); // not tested, no camera with this mode available
101 void RGB16toRGB32(unsigned char * buffer); // not tested, no camera with this mode available
102 void RGB24toRGB32(unsigned char * buffer);
103
104 inline void startAcquiring() { acquiring_ = TRUE; };
105 inline void stopAcquiring() { acquiring_ = FALSE; };
106 inline void startRecording() { recording_ = TRUE; };
107 inline void stopRecording() { recording_ = FALSE; };
108
109 virtual void stopActivity(); /*!< to stop the processing thread */
110 virtual void startActivity(); /*!< to start the processing thread */
111 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
112
113 // return the period in µs corresponding to the framerate parameter
114 double getPeriod();
115 bool recordImage(QString format);
116
117Q_SIGNALS:
118 void newImage(QImage*);
119 void corruptedImage();
120
121protected:
122 C1394Camera * theCamera;
123 unsigned char * image_;
124 QImage * qimage_;
125
126private:
127 // Initialize the camera
128 bool initCamera();
129
130 // return true if the period T (µs) corresponds to the framerate (at +/-20%)
131 bool isPeriodGood(int T);
132
133 // properties
134 int cameraNode_;
135 int videoFormat_;
136 int videoMode_;
137 int frameRate_;
138 bool reverseImage_;
139 bool acquiring_;
140 bool displaying_;
141 bool recording_;
142 int zoom_;
143
144 int imageCounter_;
145 QString recordFormat_;
146
147 char imageName_[MAX_CHAR_PICTURE_NAME+MAX_CHAR_DIRECTORY_NAME];
148 QMutex* imageMutex_;
149
150 road_time_t time_;
151 road_time_t prevTime_;
152 road_timerange_t tr_;
153
154 pacpus::DbiteFile file_;
155
156 ImageViewer * viewer_;
157
158};
159
160} // namespace pacpus
161
162#endif // _CAMERA1394_H_
Note: See TracBrowser for help on using the repository browser.