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 "an alias to frameRateRange. Sets the sensor frame rate range to (RATE, RATE). If"
146 " RATE is 0 then VFR (variable frame rate) is enabled.",
148 PROPAGATE_ERROR(options.addOption(
149 createValueOption(
"frameraterange", 0,
"RANGE",
150 "set the sensor frame rate range to RANGE. If RANGE is 0,0 then VFR (variable frame "
152 PROPAGATE_ERROR(options.addOption(
153 createValueOption(
"focusposition", 0,
"POSITION",
154 "sets the focus position to POSITION, in focuser units.",
156 PROPAGATE_ERROR(options.addOption(
157 createValueOption(
"apertureposition", 0,
"POSITION",
158 "sets the aperture position to POSITION, in position units.",
160 PROPAGATE_ERROR(options.addOption(
161 createValueOption(
"apertureFnum", 0,
"Fnum",
162 "sets the aperture F-num, in F-num units.",
164 PROPAGATE_ERROR(options.addOption(
165 createValueOption(
"aperturemotorspeed", 0,
"SPEED",
166 "sets the aperture motor speed to SPEED, in steps/second units.",
168 PROPAGATE_ERROR(options.addOption(
169 createValueOption(
"captureyuvformat", 0,
"FORMAT",
173 PROPAGATE_ERROR(options.addOption(
174 createValueOption(
"outputsize", 0,
"WIDTHxHEIGHT",
175 "set the still and video output size to WIDTHxHEIGHT (e.g. 1920x1080). If WIDTHxHEIGHT "
176 "is '0x0' the output size is the sensor mode size.",
178 PROPAGATE_ERROR(options.addOption(
179 createValueOption(
"outputpath", 0,
"PATH",
180 "set the output file path. A file name, an incrementing index and the file extension"
181 " will be appended. E.g. setting 'folder/' will result in 'folder/image0.jpg' or "
182 "'folder/video0.mp4'. '/dev/null' can be used to discard output.",
186 PROPAGATE_ERROR(options.addOption(
187 createValueOption(
"denoise", 0,
"MODE",
"set the denoising mode.",
189 PROPAGATE_ERROR(options.addOption(
190 createValueOption(
"denoisestrength", 0,
"POSITION",
"set the denoising strength.",
192 PROPAGATE_ERROR(options.addOption(
193 createValueOption(
"edgeenhance", 0,
"MODE",
"set the edge enhancement mode.",
195 PROPAGATE_ERROR(options.addOption(
196 createValueOption(
"edgeenhancestrength", 0,
"POSITION",
197 "set the edge enhancement strength.",
201 PROPAGATE_ERROR(options.addOption(
202 createValueOption(
"aeantibanding", 0,
"MODE",
"set the auto exposure antibanding mode.",
204 PROPAGATE_ERROR(options.addOption(
205 createValueOption(
"aelock", 0,
"LOCK",
"set the auto exposure lock.",
207 PROPAGATE_ERROR(options.addOption(
208 createValueOption(
"awblock", 0,
"LOCK",
"set the auto white balance lock.",
210 PROPAGATE_ERROR(options.addOption(
211 createValueOption(
"awb", 0,
"MODE",
"set the auto white balance mode.",
213 PROPAGATE_ERROR(options.addOption(
214 createValueOption(
"exposurecompensation", 0,
"COMPENSATION",
215 "set the exposure compensation to COMPENSATION.",
217 PROPAGATE_ERROR(options.addOption(
218 createValueOption(
"ispdigitalgainrange", 0,
"RANGE",
219 "sets the ISP digital gain range.",
221 PROPAGATE_ERROR(options.addOption(
222 createValueOption(
"acregionhorizontal", 0,
"RANGE",
223 "sets the AC auto control region horizontal range.",
225 PROPAGATE_ERROR(options.addOption(
226 createValueOption(
"acregionvertical", 0,
"RANGE",
227 "sets the AC auto control region vertical range.",
233 PROPAGATE_ERROR(options.addOption(
234 createValueOption(
"defog", 0,
"ENABLE",
235 "set the DeFog enable flag to ENABLE.",
237 PROPAGATE_ERROR(options.addOption(
238 createValueOption(
"defogamount", 0,
"AMOUNT",
239 "sets the amount of fog to be removed to AMOUNT.",
241 PROPAGATE_ERROR(options.addOption(
242 createValueOption(
"defogquality", 0,
"QUALITY",
243 "sets the quality of the DeFog effect to QUALITY.",
257 PROPAGATE_ERROR_CONTINUE(
stop());
268 Window::IGuiContainer *iGuiContainerConfig)
277 UniquePointer<Window::IGuiMenu> menu;
278 UniquePointer<Window::IGuiMenuItem> item;
281 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
284 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
285 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
286 fileMenu = menu.get();
291 PROPAGATE_ERROR(fileMenu->add(item.get()));
295 PROPAGATE_ERROR(fileMenu->add(item.get()));
299 PROPAGATE_ERROR(fileMenu->add(item.get()));
302 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
305 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
306 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
307 helpMenu = menu.get();
312 PROPAGATE_ERROR(helpMenu->add(item.get()));
323 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
326 UniquePointer<Window::IGuiElement> element;
329 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
331 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
332 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
333 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
336 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
337 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
338 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
339 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
340 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
343 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
344 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
346 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
360 uint32_t, Window::IGuiElement::ValueTypeEnum);
362 Argus::PixelFormat, Argus::NamedUUID);
367 float, Window::IGuiElement::ValueTypeEnum);
374 Argus::DenoiseMode, Argus::NamedUUID);
377 Argus::EdgeEnhanceMode, Argus::NamedUUID);
381 Argus::AeAntibandingMode, Argus::NamedUUID);
386 Argus::AwbMode, Argus::NamedUUID);
389 #undef CREATE_GUI_ELEMENT
390 #undef CREATE_GUI_ELEMENT_COMBO_BOX
391 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER