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(
"aperturemotorstep", 0,
"STEP",
153 "sets the aperture motor step to STEP, in step units.",
155 PROPAGATE_ERROR(options.addOption(
156 createValueOption(
"aperturemotorspeed", 0,
"SPEED",
157 "sets the aperture motor speed to SPEED, in steps/second units.",
159 PROPAGATE_ERROR(options.addOption(
160 createValueOption(
"captureyuvformat", 0,
"FORMAT",
164 PROPAGATE_ERROR(options.addOption(
165 createValueOption(
"outputsize", 0,
"WIDTHxHEIGHT",
166 "set the still and video output size to WIDTHxHEIGHT (e.g. 1920x1080). If WIDTHxHEIGHT "
167 "is '0x0' the output size is the sensor mode size.",
169 PROPAGATE_ERROR(options.addOption(
170 createValueOption(
"outputpath", 0,
"PATH",
171 "set the output file path. A file name, an incrementing index and the file extension"
172 " will be appended. E.g. setting 'folder/' will result in 'folder/image0.jpg' or "
173 "'folder/video0.mp4'. '/dev/null' can be used to discard output.",
177 PROPAGATE_ERROR(options.addOption(
178 createValueOption(
"denoise", 0,
"MODE",
"set the denoising mode.",
180 PROPAGATE_ERROR(options.addOption(
181 createValueOption(
"denoisestrength", 0,
"POSITION",
"set the denoising strength.",
183 PROPAGATE_ERROR(options.addOption(
184 createValueOption(
"edgeenhance", 0,
"MODE",
"set the edge enhancement mode.",
186 PROPAGATE_ERROR(options.addOption(
187 createValueOption(
"edgeenhancestrength", 0,
"POSITION",
188 "set the edge enhancement strength.",
192 PROPAGATE_ERROR(options.addOption(
193 createValueOption(
"aeantibanding", 0,
"MODE",
"set the auto exposure antibanding mode.",
195 PROPAGATE_ERROR(options.addOption(
196 createValueOption(
"aelock", 0,
"LOCK",
"set the auto exposure lock.",
198 PROPAGATE_ERROR(options.addOption(
199 createValueOption(
"awblock", 0,
"LOCK",
"set the auto white balance lock.",
201 PROPAGATE_ERROR(options.addOption(
202 createValueOption(
"awb", 0,
"MODE",
"set the auto white balance mode.",
204 PROPAGATE_ERROR(options.addOption(
205 createValueOption(
"exposurecompensation", 0,
"COMPENSATION",
206 "set the exposure compensation to COMPENSATION.",
208 PROPAGATE_ERROR(options.addOption(
209 createValueOption(
"ispdigitalgainrange", 0,
"RANGE",
210 "sets the ISP digital gain range.",
216 PROPAGATE_ERROR(options.addOption(
217 createValueOption(
"defog", 0,
"ENABLE",
218 "set the DeFog enable flag to ENABLE.",
220 PROPAGATE_ERROR(options.addOption(
221 createValueOption(
"defogamount", 0,
"AMOUNT",
222 "sets the amount of fog to be removed to AMOUNT.",
224 PROPAGATE_ERROR(options.addOption(
225 createValueOption(
"defogquality", 0,
"QUALITY",
226 "sets the quality of the DeFog effect to QUALITY.",
240 PROPAGATE_ERROR_CONTINUE(
stop());
251 Window::IGuiContainer *iGuiContainerConfig)
260 UniquePointer<Window::IGuiMenu> menu;
261 UniquePointer<Window::IGuiMenuItem> item;
264 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
267 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
268 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
269 fileMenu = menu.get();
274 PROPAGATE_ERROR(fileMenu->add(item.get()));
278 PROPAGATE_ERROR(fileMenu->add(item.get()));
282 PROPAGATE_ERROR(fileMenu->add(item.get()));
285 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
288 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
289 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
290 helpMenu = menu.get();
295 PROPAGATE_ERROR(helpMenu->add(item.get()));
306 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
309 UniquePointer<Window::IGuiElement> element;
312 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
314 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
315 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
316 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
319 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
320 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
321 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
322 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
323 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
326 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
327 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
329 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
341 uint32_t, Window::IGuiElement::ValueTypeEnum);
343 Argus::PixelFormat, Argus::NamedUUID);
353 Argus::DenoiseMode, Argus::NamedUUID);
356 Argus::EdgeEnhanceMode, Argus::NamedUUID);
360 Argus::AeAntibandingMode, Argus::NamedUUID);
365 Argus::AwbMode, Argus::NamedUUID);
368 #undef CREATE_GUI_ELEMENT
369 #undef CREATE_GUI_ELEMENT_COMBO_BOX
370 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER