39 #include <Argus/Ext/DeFog.h>
41 namespace ArgusSamples
47 #define DEFAULT_CONFIG_FILE "argusAppConfig.xml"
53 printf(
"%s\n", info.c_str());
82 PROPAGATE_ERROR(Window::getInstance().requestExit());
87 : m_initialized(false)
90 , m_guiContainerConfig(NULL)
105 PROPAGATE_ERROR(options.addDescription(
106 "The supported value range of some settings is device or sensor mode dependent.\n"
107 "Use the '--info' option to get a list of the supported values.\n"));
109 PROPAGATE_ERROR(options.addOption(
110 Options::Option(
"info",
'i',
"",
111 Options::Option::TYPE_ACTION,
"print information on devices.",
info)));
113 PROPAGATE_ERROR(options.addOption(
114 Options::Option(
"loadconfig", 0,
"FILE",
115 Options::Option::TYPE_ACTION,
"load configuration from XML FILE. ",
117 PROPAGATE_ERROR(options.addOption(
118 Options::Option(
"saveconfig", 0,
"FILE",
119 Options::Option::TYPE_ACTION,
"save configuration to XML FILE. ",
122 PROPAGATE_ERROR(options.addOption(
123 createValueOption(
"verbose", 0,
"0 or 1",
"enable verbose mode.",
125 PROPAGATE_ERROR(options.addOption(
126 createValueOption(
"kpi", 0,
"0 or 1",
"enable kpi mode.",
128 PROPAGATE_ERROR(options.addOption(
129 createValueOption(
"device",
'd',
"INDEX",
"select camera device with INDEX.",
133 PROPAGATE_ERROR(options.addOption(
134 createValueOption(
"exposuretimerange", 0,
"RANGE",
135 "sets the exposure time range to RANGE, in nanoseconds.",
137 PROPAGATE_ERROR(options.addOption(
138 createValueOption(
"gainrange", 0,
"RANGE",
"sets the gain range to RANGE.",
140 PROPAGATE_ERROR(options.addOption(
141 createValueOption(
"sensormode", 0,
"INDEX",
"set sensor mode to INDEX.",
143 PROPAGATE_ERROR(options.addOption(
144 createValueOption(
"framerate", 0,
"RATE",
145 "set the sensor frame rate to RATE. If RATE is 0 then VFR (variable frame rate) is "
147 PROPAGATE_ERROR(options.addOption(
148 createValueOption(
"focusposition", 0,
"POSITION",
149 "sets the focus position to POSITION, in focuser units.",
151 PROPAGATE_ERROR(options.addOption(
152 createValueOption(
"apertureposition", 0,
"POSITION",
153 "sets the aperture position to POSITION, in position units.",
155 PROPAGATE_ERROR(options.addOption(
156 createValueOption(
"apertureFnum", 0,
"Fnum",
157 "sets the aperture F-num, in F-num units.",
159 PROPAGATE_ERROR(options.addOption(
160 createValueOption(
"aperturemotorspeed", 0,
"SPEED",
161 "sets the aperture motor speed to SPEED, in steps/second units.",
163 PROPAGATE_ERROR(options.addOption(
164 createValueOption(
"captureyuvformat", 0,
"FORMAT",
168 PROPAGATE_ERROR(options.addOption(
169 createValueOption(
"outputsize", 0,
"WIDTHxHEIGHT",
170 "set the still and video output size to WIDTHxHEIGHT (e.g. 1920x1080). If WIDTHxHEIGHT "
171 "is '0x0' the output size is the sensor mode size.",
173 PROPAGATE_ERROR(options.addOption(
174 createValueOption(
"outputpath", 0,
"PATH",
175 "set the output file path. A file name, an incrementing index and the file extension"
176 " will be appended. E.g. setting 'folder/' will result in 'folder/image0.jpg' or "
177 "'folder/video0.mp4'. '/dev/null' can be used to discard output.",
181 PROPAGATE_ERROR(options.addOption(
182 createValueOption(
"denoise", 0,
"MODE",
"set the denoising mode.",
184 PROPAGATE_ERROR(options.addOption(
185 createValueOption(
"denoisestrength", 0,
"POSITION",
"set the denoising strength.",
187 PROPAGATE_ERROR(options.addOption(
188 createValueOption(
"edgeenhance", 0,
"MODE",
"set the edge enhancement mode.",
190 PROPAGATE_ERROR(options.addOption(
191 createValueOption(
"edgeenhancestrength", 0,
"POSITION",
192 "set the edge enhancement strength.",
196 PROPAGATE_ERROR(options.addOption(
197 createValueOption(
"aeantibanding", 0,
"MODE",
"set the auto exposure antibanding mode.",
199 PROPAGATE_ERROR(options.addOption(
200 createValueOption(
"aelock", 0,
"LOCK",
"set the auto exposure lock.",
202 PROPAGATE_ERROR(options.addOption(
203 createValueOption(
"awblock", 0,
"LOCK",
"set the auto white balance lock.",
205 PROPAGATE_ERROR(options.addOption(
206 createValueOption(
"awb", 0,
"MODE",
"set the auto white balance mode.",
208 PROPAGATE_ERROR(options.addOption(
209 createValueOption(
"exposurecompensation", 0,
"COMPENSATION",
210 "set the exposure compensation to COMPENSATION.",
212 PROPAGATE_ERROR(options.addOption(
213 createValueOption(
"ispdigitalgainrange", 0,
"RANGE",
214 "sets the ISP digital gain range.",
216 PROPAGATE_ERROR(options.addOption(
217 createValueOption(
"acregionhorizontal", 0,
"RANGE",
218 "sets the AC auto control region horizontal range.",
220 PROPAGATE_ERROR(options.addOption(
221 createValueOption(
"acregionvertical", 0,
"RANGE",
222 "sets the AC auto control region vertical range.",
228 PROPAGATE_ERROR(options.addOption(
229 createValueOption(
"defog", 0,
"ENABLE",
230 "set the DeFog enable flag to ENABLE.",
232 PROPAGATE_ERROR(options.addOption(
233 createValueOption(
"defogamount", 0,
"AMOUNT",
234 "sets the amount of fog to be removed to AMOUNT.",
236 PROPAGATE_ERROR(options.addOption(
237 createValueOption(
"defogquality", 0,
"QUALITY",
238 "sets the quality of the DeFog effect to QUALITY.",
252 PROPAGATE_ERROR_CONTINUE(
stop());
263 Window::IGuiContainer *iGuiContainerConfig)
272 UniquePointer<Window::IGuiMenu> menu;
273 UniquePointer<Window::IGuiMenuItem> item;
276 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
279 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
280 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
281 fileMenu = menu.get();
286 PROPAGATE_ERROR(fileMenu->add(item.get()));
290 PROPAGATE_ERROR(fileMenu->add(item.get()));
294 PROPAGATE_ERROR(fileMenu->add(item.get()));
297 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
300 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
301 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
302 helpMenu = menu.get();
307 PROPAGATE_ERROR(helpMenu->add(item.get()));
318 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
321 UniquePointer<Window::IGuiElement> element;
324 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
326 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
327 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
328 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
331 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
332 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
333 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
334 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
335 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
338 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
339 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
341 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
355 uint32_t, Window::IGuiElement::ValueTypeEnum);
357 Argus::PixelFormat, Argus::NamedUUID);
362 float, Window::IGuiElement::ValueTypeEnum);
369 Argus::DenoiseMode, Argus::NamedUUID);
372 Argus::EdgeEnhanceMode, Argus::NamedUUID);
376 Argus::AeAntibandingMode, Argus::NamedUUID);
381 Argus::AwbMode, Argus::NamedUUID);
384 #undef CREATE_GUI_ELEMENT
385 #undef CREATE_GUI_ELEMENT_COMBO_BOX
386 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER