stromx  0.8.0
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 DataId
47  {
48  OUTPUT,
49  INDEX,
50  OUTPUT_INDEX,
51  IMAGE,
52  TRIGGER_MODE,
53  TRIGGER,
54  EXPOSURE,
55  FRAME_PERIOD,
56  BUFFER_SIZE,
57  NUM_BUFFERS,
58  WHITE_BALANCE_RED,
59  WHITE_BALANCE_GREEN,
60  WHITE_BALANCE_BLUE,
61  LEFT,
62  TOP,
63  WIDTH,
64  HEIGHT,
65  PIXEL_TYPE,
66  WHITE_BALANCE_GROUP,
67  ROI_GROUP,
68  FLICKER_AMOUNT
69  };
70 
71  enum TriggerMode
72  {
73  SOFTWARE,
74  INTERNAL,
75  EXTERNAL
76  };
77 
78  DummyCamera();
79  virtual ~DummyCamera();
80 
81  virtual OperatorKernel* clone() const { return new DummyCamera; }
82  virtual void setParameter(const unsigned int id, const runtime::Data& value);
83  virtual const runtime::DataRef getParameter(const unsigned int id) const;
84  virtual void execute(runtime::DataProvider& provider);
85  virtual void initialize();
86  virtual void deinitialize();
87  virtual void activate();
88  virtual void deactivate();
89 
90  private:
91  static bool validateBufferSize(unsigned int bufferSize,
92  unsigned int width,
93  unsigned int height,
94  unsigned int depth,
95  const runtime::Enum outputType);
96 
97  const std::vector<const runtime::Parameter*> setupInitParameters();
98  const std::vector<const runtime::Input*> setupInputs();
99  const std::vector<const runtime::Output*> setupOutputs();
100  const std::vector<const runtime::Parameter*> setupParameters();
101  void setRgbParameters();
102 
103  static const std::string TYPE;
104  static const std::string PACKAGE;
105  static const runtime::Version VERSION;
106 
107  static const unsigned int WHITE_BALANCE_MAX = 10;
108  static const unsigned int BASE_EXPOSURE = 10;
109 
110  runtime::Stream* m_stream;
111 
112  runtime::Operator* m_input;
113  runtime::Operator* m_clip;
114  runtime::Operator* m_adjustRgbChannels;
115  runtime::Operator* m_flicker;
116  runtime::Operator* m_period;
117  runtime::Operator* m_trigger;
118  runtime::Operator* m_buffer;
119  runtime::Operator* m_pixelType;
120  runtime::Operator* m_imageQueue;
121  runtime::Operator* m_indexQueue;
122 
123  runtime::Bool m_outputIndex;
124 
129 
130  unsigned int m_imageWidth;
131  unsigned int m_imageHeight;
132  unsigned int m_imageDepth;
133  runtime::UInt32 m_exposure;
134  runtime::Float64 m_wbRed;
135  runtime::Float64 m_wbGreen;
136  runtime::Float64 m_wbBlue;
137 
138  bool m_isFirstInitialization;
139  };
140  }
141 }
142 
143 #endif // STROMX_CVSUPPORT_DUMMYCAMERA_H
A version of an operator or data type.
Definition: Version.h:46
Abstract data object.
Definition: Data.h:53
virtual OperatorKernel * clone() const
Definition: DummyCamera.h:81
Reference to a data object.
Definition: DataRef.h:48
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
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
Description of a numeric parameter
Definition: DummyCamera.h:37