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());
99 : m_initialized(false)
102 , m_guiContainerConfig(NULL)
117 PROPAGATE_ERROR(options.addDescription(
118 "The supported value range of some settings is device or sensor mode dependent.\n"
119 "Use the '--info' option to get a list of the supported values.\n"));
121 PROPAGATE_ERROR(options.addOption(
122 Options::Option(
"info",
'i',
"",
123 Options::Option::TYPE_ACTION, Options::Option::FLAG_NO_ARGUMENT,
124 "print information on devices.",
info)));
126 PROPAGATE_ERROR(options.addOption(
127 Options::Option(
"loadconfig", 0,
"FILE",
128 Options::Option::TYPE_ACTION, Options::Option::FLAG_OPTIONAL_ARGUMENT,
131 PROPAGATE_ERROR(options.addOption(
132 Options::Option(
"saveconfig", 0,
"FILE",
133 Options::Option::TYPE_ACTION, Options::Option::FLAG_OPTIONAL_ARGUMENT,
137 PROPAGATE_ERROR(options.addOption(
139 "enable verbose mode.",
verbose)));
140 PROPAGATE_ERROR(options.addOption(
142 "enable kpi mode.",
kpi)));
143 PROPAGATE_ERROR(options.addOption(
144 createValueOption(
"device",
'd',
"INDEX",
"select camera device with INDEX.",
148 PROPAGATE_ERROR(options.addOption(
149 createValueOption(
"exposuretimerange", 0,
"RANGE",
150 "sets the exposure time range to RANGE, in nanoseconds.",
152 PROPAGATE_ERROR(options.addOption(
153 createValueOption(
"gainrange", 0,
"RANGE",
"sets the gain range to RANGE.",
155 PROPAGATE_ERROR(options.addOption(
156 createValueOption(
"sensormode", 0,
"INDEX",
"set sensor mode to INDEX.",
158 PROPAGATE_ERROR(options.addOption(
159 createValueOption(
"framerate", 0,
"RATE",
160 "set the sensor frame rate to RATE. If RATE is 0 then VFR (variable frame rate) is "
162 PROPAGATE_ERROR(options.addOption(
163 createValueOption(
"focusposition", 0,
"POSITION",
164 "sets the focus position to POSITION, in focuser units.",
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 will "
176 "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(
"vstab", 0,
"MODE",
"set the video stabilization mode.",
184 PROPAGATE_ERROR(options.addOption(
185 createValueOption(
"denoise", 0,
"MODE",
"set the denoising mode.",
187 PROPAGATE_ERROR(options.addOption(
188 createValueOption(
"denoisestrength", 0,
"POSITION",
"set the denoising strength.",
190 PROPAGATE_ERROR(options.addOption(
191 createValueOption(
"edgeenhance", 0,
"MODE",
"set the edge enhancement mode.",
193 PROPAGATE_ERROR(options.addOption(
194 createValueOption(
"edgeenhancestrength", 0,
"POSITION",
195 "set the edge enhancement strength.",
199 PROPAGATE_ERROR(options.addOption(
200 createValueOption(
"aeantibanding", 0,
"MODE",
"set the auto exposure antibanding mode.",
202 PROPAGATE_ERROR(options.addOption(
203 createValueOption(
"aelock", 0,
"LOCK",
"set the auto exposure lock.",
205 PROPAGATE_ERROR(options.addOption(
206 createValueOption(
"awblock", 0,
"LOCK",
"set the auto white balance lock.",
208 PROPAGATE_ERROR(options.addOption(
209 createValueOption(
"awb", 0,
"MODE",
"set the auto white balance mode.",
211 PROPAGATE_ERROR(options.addOption(
212 createValueOption(
"exposurecompensation", 0,
"COMPENSATION",
213 "set the exposure compensation to COMPENSATION.",
215 PROPAGATE_ERROR(options.addOption(
216 createValueOption(
"ispdigitalgainrange", 0,
"RANGE",
217 "sets the ISP digital gain range.",
223 PROPAGATE_ERROR(options.addOption(
224 createValueOption(
"defog", 0,
"ENABLE",
225 "set the DeFog enable flag to ENABLE.",
227 PROPAGATE_ERROR(options.addOption(
228 createValueOption(
"defogamount", 0,
"AMOUNT",
229 "sets the amount of fog to be removed to AMOUNT.",
231 PROPAGATE_ERROR(options.addOption(
232 createValueOption(
"defogquality", 0,
"QUALITY",
233 "sets the quality of the DeFog effect to QUALITY.",
247 PROPAGATE_ERROR_CONTINUE(
stop());
258 Window::IGuiContainer *iGuiContainerConfig)
267 UniquePointer<Window::IGuiMenu> menu;
268 UniquePointer<Window::IGuiMenuItem> item;
271 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
274 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
275 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
276 fileMenu = menu.get();
281 PROPAGATE_ERROR(fileMenu->add(item.get()));
285 PROPAGATE_ERROR(fileMenu->add(item.get()));
289 PROPAGATE_ERROR(fileMenu->add(item.get()));
292 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
295 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
296 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
297 helpMenu = menu.get();
302 PROPAGATE_ERROR(helpMenu->add(item.get()));
313 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
316 UniquePointer<Window::IGuiElement> element;
319 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
321 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
322 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
323 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
326 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
327 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
328 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
329 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
330 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
333 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
334 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
336 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
348 uint32_t, Window::IGuiElement::ValueTypeEnum);
356 Argus::VideoStabilizationMode, Argus::NamedUUID);
358 Argus::DenoiseMode, Argus::NamedUUID);
361 Argus::EdgeEnhanceMode, Argus::NamedUUID);
365 Argus::AeAntibandingMode, Window::IGuiElement::ValueTypeEnum);
370 Argus::AwbMode, Argus::NamedUUID);
373 #undef CREATE_GUI_ELEMENT
374 #undef CREATE_GUI_ELEMENT_COMBO_BOX
375 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER