stromx  0.7.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
DummyCamera.h
1 /*
2 * Copyright 2011 Matthias Fuchs
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #ifndef STROMX_CVSUPPORT_DUMMYCAMERA_H
18 #define STROMX_CVSUPPORT_DUMMYCAMERA_H
19 
20 #include "stromx/cvsupport/Config.h"
21 #include <stromx/runtime/DataRef.h>
22 #include <stromx/runtime/Enum.h>
23 #include <stromx/runtime/Image.h>
24 #include <stromx/runtime/OperatorKernel.h>
25 #include <stromx/runtime/Primitive.h>
26 #include <stromx/runtime/TriggerData.h>
27 
28 namespace stromx
29 {
30  namespace runtime
31  {
32  class DataContainer;
33  class Operator;
34  class Stream;
35 
36  template<typename T>
38  }
39 
40  namespace cvsupport
41  {
43  class STROMX_CVSUPPORT_API DummyCamera : public runtime::OperatorKernel
44  {
45  public:
46  enum OutputId
47  {
48  OUTPUT,
49  INDEX
50  };
51 
52  enum ParameterId
53  {
54  OUTPUT_INDEX,
55  IMAGE,
56  TRIGGER_MODE,
57  TRIGGER,
58  EXPOSURE,
59  FRAME_PERIOD,
60  BUFFER_SIZE,
61  NUM_BUFFERS,
62  WHITE_BALANCE_RED,
63  WHITE_BALANCE_GREEN,
64  WHITE_BALANCE_BLUE,
65  LEFT,
66  TOP,
67  WIDTH,
68  HEIGHT,
69  PIXEL_TYPE,
70  WHITE_BALANCE_GROUP,
71  ROI_GROUP,
72  FLICKER_AMOUNT
73  };
74 
75  enum TriggerMode
76  {
77  SOFTWARE,
78  INTERNAL,
79  EXTERNAL
80  };
81 
82  DummyCamera();
83  virtual ~DummyCamera();
84 
85  virtual OperatorKernel* clone() const { return new DummyCamera; }
86  virtual void setParameter(const unsigned int id, const runtime::Data& value);
87  virtual const runtime::DataRef getParameter(const unsigned int id) const;
88  virtual void execute(runtime::DataProvider& provider);
89  virtual void initialize();
90  virtual void deinitialize();
91  virtual void activate();
92  virtual void deactivate();
93 
94  private:
95  static bool validateBufferSize(unsigned int bufferSize,
96  unsigned int width,
97  unsigned int height,
98  unsigned int depth,
99  const runtime::Enum outputType);
100 
101  const std::vector<const runtime::Parameter*> setupInitParameters();
102  const std::vector<const runtime::Description*> setupInputs();
103  const std::vector<const runtime::Description*> setupOutputs();
104  const std::vector<const runtime::Parameter*> setupParameters();
105  void setRgbParameters();
106 
107  static const std::string TYPE;
108  static const std::string PACKAGE;
109  static const runtime::Version VERSION;
110 
111  static const unsigned int WHITE_BALANCE_MAX = 10;
112  static const unsigned int BASE_EXPOSURE = 10;
113 
114  runtime::Stream* m_stream;
115 
116  runtime::Operator* m_input;
117  runtime::Operator* m_clip;
118  runtime::Operator* m_adjustRgbChannels;
119  runtime::Operator* m_flicker;
120  runtime::Operator* m_period;
121  runtime::Operator* m_trigger;
122  runtime::Operator* m_buffer;
123  runtime::Operator* m_pixelType;
124  runtime::Operator* m_imageQueue;
125  runtime::Operator* m_indexQueue;
126 
127  runtime::Bool m_outputIndex;
128 
133 
134  unsigned int m_imageWidth;
135  unsigned int m_imageHeight;
136  unsigned int m_imageDepth;
137  runtime::UInt32 m_exposure;
138  runtime::Float64 m_wbRed;
139  runtime::Float64 m_wbGreen;
140  runtime::Float64 m_wbBlue;
141 
142  bool m_isFirstInitialization;
143  };
144  }
145 }
146 
147 #endif // STROMX_CVSUPPORT_DUMMYCAMERA_H
A version of an operator or data type.
Definition: Version.h:46
Abstract data object.
Definition: Data.h:53
Reference to a data object.
Definition: DataRef.h:48
virtual OperatorKernel * clone() const
Definition: DummyCamera.h:85
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
Description of a numeric parameter
Definition: DummyCamera.h:37
The core data processing pipeline of stromx.
Definition: Stream.h:45
Abstract operator.
Definition: Operator.h:60
Abstract operator kernel.
Definition: OperatorKernel.h:46
Provider of functions to receive and send data.
Definition: DataProvider.h:35
Simulates a camera input.
Definition: DummyCamera.h:43
Value of an enumeration.
Definition: Enum.h:27