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",
191 "set the denoising strength. Negative values are for auto-control"
192 " and positive values for manual settings.",
194 PROPAGATE_ERROR(options.addOption(
195 createValueOption(
"edgeenhance", 0,
"MODE",
"set the edge enhancement mode.",
197 PROPAGATE_ERROR(options.addOption(
198 createValueOption(
"edgeenhancestrength", 0,
"POSITION",
199 "set the edge enhancement strength. Negative values are for auto-control"
200 " and positive values for manual settings.",
204 PROPAGATE_ERROR(options.addOption(
205 createValueOption(
"aeantibanding", 0,
"MODE",
"set the auto exposure antibanding mode.",
207 PROPAGATE_ERROR(options.addOption(
208 createValueOption(
"aelock", 0,
"LOCK",
"set the auto exposure lock.",
210 PROPAGATE_ERROR(options.addOption(
211 createValueOption(
"awblock", 0,
"LOCK",
"set the auto white balance lock.",
213 PROPAGATE_ERROR(options.addOption(
214 createValueOption(
"awb", 0,
"MODE",
"set the auto white balance mode.",
216 PROPAGATE_ERROR(options.addOption(
217 createValueOption(
"exposurecompensation", 0,
"COMPENSATION",
218 "set the exposure compensation to COMPENSATION.",
220 PROPAGATE_ERROR(options.addOption(
221 createValueOption(
"ispdigitalgainrange", 0,
"RANGE",
222 "sets the ISP digital gain range.",
224 PROPAGATE_ERROR(options.addOption(
225 createValueOption(
"acregionhorizontal", 0,
"RANGE",
226 "sets the AC auto control region horizontal range.",
228 PROPAGATE_ERROR(options.addOption(
229 createValueOption(
"acregionvertical", 0,
"RANGE",
230 "sets the AC auto control region vertical range.",
236 PROPAGATE_ERROR(options.addOption(
237 createValueOption(
"defog", 0,
"ENABLE",
238 "set the DeFog enable flag to ENABLE.",
240 PROPAGATE_ERROR(options.addOption(
241 createValueOption(
"defogamount", 0,
"AMOUNT",
242 "sets the amount of fog to be removed to AMOUNT.",
244 PROPAGATE_ERROR(options.addOption(
245 createValueOption(
"defogquality", 0,
"QUALITY",
246 "sets the quality of the DeFog effect to QUALITY.",
260 PROPAGATE_ERROR_CONTINUE(
stop());
271 Window::IGuiContainer *iGuiContainerConfig)
280 UniquePointer<Window::IGuiMenu> menu;
281 UniquePointer<Window::IGuiMenuItem> item;
284 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
287 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
288 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
289 fileMenu = menu.get();
294 PROPAGATE_ERROR(fileMenu->add(item.get()));
298 PROPAGATE_ERROR(fileMenu->add(item.get()));
302 PROPAGATE_ERROR(fileMenu->add(item.get()));
305 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
308 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
309 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
310 helpMenu = menu.get();
315 PROPAGATE_ERROR(helpMenu->add(item.get()));
326 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
329 UniquePointer<Window::IGuiElement> element;
332 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
334 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
335 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
336 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
339 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
340 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
341 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
342 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
343 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
346 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
347 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
349 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
363 uint32_t, Window::IGuiElement::ValueTypeEnum);
365 Argus::PixelFormat, Argus::NamedUUID);
370 float, Window::IGuiElement::ValueTypeEnum);
377 Argus::DenoiseMode, Argus::NamedUUID);
380 Argus::EdgeEnhanceMode, Argus::NamedUUID);
384 Argus::AeAntibandingMode, Argus::NamedUUID);
389 Argus::AwbMode, Argus::NamedUUID);
392 #undef CREATE_GUI_ELEMENT
393 #undef CREATE_GUI_ELEMENT_COMBO_BOX
394 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER