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());
214 : m_initialized(false)
217 , m_guiContainerConfig(NULL)
232 PROPAGATE_ERROR(options.addDescription(
233 "The supported value range of some settings is device or sensor mode dependent.\n"
234 "Use the '--info' option to get a list of the supported values.\n"));
236 PROPAGATE_ERROR(options.addOption(
237 Options::Option(
"info",
'i',
"",
238 Options::Option::TYPE_ACTION, Options::Option::FLAG_NO_ARGUMENT,
239 "print information on devices.",
info)));
241 PROPAGATE_ERROR(options.addOption(
242 Options::Option(
"loadconfig", 0,
"FILE",
243 Options::Option::TYPE_ACTION, Options::Option::FLAG_OPTIONAL_ARGUMENT,
246 PROPAGATE_ERROR(options.addOption(
247 Options::Option(
"saveconfig", 0,
"FILE",
248 Options::Option::TYPE_ACTION, Options::Option::FLAG_OPTIONAL_ARGUMENT,
252 PROPAGATE_ERROR(options.addOption(
254 "enable verbose mode.",
verbose)));
255 PROPAGATE_ERROR(options.addOption(
257 "enable kpi mode.",
kpi)));
258 PROPAGATE_ERROR(options.addOption(
260 "select camera device with INDEX.",
device)));
263 PROPAGATE_ERROR(options.addOption(
264 Options::Option(
"exposuretimerange", 0,
"RANGE",
266 "sets the exposure time range to RANGE, in nanoseconds.",
268 PROPAGATE_ERROR(options.addOption(
270 "sets the gain range to RANGE.",
gainRange)));
271 PROPAGATE_ERROR(options.addOption(
274 PROPAGATE_ERROR(options.addOption(
276 "set the sensor frame rate to RATE. If RATE is 0 then VFR (variable frame rate) is "
278 PROPAGATE_ERROR(options.addOption(
280 "sets the focus position to POSITION, in focuser units.",
284 PROPAGATE_ERROR(options.addOption(
286 "set the still and video output size to WIDTHxHEIGHT (e.g. 1920x1080). If WIDTHxHEIGHT "
287 "is '0x0' the output size is the sensor mode size.",
outputSize)));
288 PROPAGATE_ERROR(options.addOption(
290 "set the output file path. A file name, an incrementing index and the file extension will "
291 "be appended. E.g. setting 'folder/' will result in 'folder/image0.jpg' or "
292 "'folder/video0.mp4'. '/dev/null' can be used to discard output.",
296 PROPAGATE_ERROR(options.addOption(
298 "set the video stabilization mode.",
vstab)));
299 PROPAGATE_ERROR(options.addOption(
301 "set the denoising mode.",
deNoise)));
304 PROPAGATE_ERROR(options.addOption(
307 PROPAGATE_ERROR(options.addOption(
309 "set the auto exposure lock.",
aeLock)));
310 PROPAGATE_ERROR(options.addOption(
312 "set the auto white balance lock.",
awbLock)));
313 PROPAGATE_ERROR(options.addOption(
315 "set the auto white balance mode.",
awb)));
316 PROPAGATE_ERROR(options.addOption(
317 Options::Option(
"exposurecompensation", 0,
"COMPENSATION",
319 "set the exposure compensation to COMPENSATION.",
321 PROPAGATE_ERROR(options.addOption(
322 Options::Option(
"ispdigitalgainrange", 0,
"RANGE",
324 "sets the ISP digital gain range.",
330 PROPAGATE_ERROR(options.addOption(
332 "set the DeFog enable flag to ENABLE.",
deFogEnable)));
333 PROPAGATE_ERROR(options.addOption(
335 "sets the amount of fog to be removed to AMOUNT.",
deFogAmount)));
336 PROPAGATE_ERROR(options.addOption(
338 "sets the quality of the DeFog effect to QUALITY.",
352 PROPAGATE_ERROR_CONTINUE(
stop());
363 Window::IGuiContainer *iGuiContainerConfig)
372 UniquePointer<Window::IGuiMenu> menu;
373 UniquePointer<Window::IGuiMenuItem> item;
376 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
379 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
380 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
381 fileMenu = menu.get();
386 PROPAGATE_ERROR(fileMenu->add(item.get()));
390 PROPAGATE_ERROR(fileMenu->add(item.get()));
394 PROPAGATE_ERROR(fileMenu->add(item.get()));
397 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
400 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
401 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
402 helpMenu = menu.get();
407 PROPAGATE_ERROR(helpMenu->add(item.get()));
418 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
421 UniquePointer<Window::IGuiElement> element;
424 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
426 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
427 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
428 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
431 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
432 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
433 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
434 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
435 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
438 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
439 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
441 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
453 uint32_t, Window::IGuiElement::ValueTypeEnum);
461 Argus::VideoStabilizationMode, Argus::NamedUUID);
463 Argus::DenoiseMode, Argus::NamedUUID);
466 Argus::AeAntibandingMode, Window::IGuiElement::ValueTypeEnum);
471 Argus::AwbMode, Argus::NamedUUID);
474 #undef CREATE_GUI_ELEMENT
475 #undef CREATE_GUI_ELEMENT_COMBO_BOX
476 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER