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(
"captureyuvformat", 0,
"FORMAT",
156 PROPAGATE_ERROR(options.addOption(
157 createValueOption(
"outputsize", 0,
"WIDTHxHEIGHT",
158 "set the still and video output size to WIDTHxHEIGHT (e.g. 1920x1080). If WIDTHxHEIGHT "
159 "is '0x0' the output size is the sensor mode size.",
161 PROPAGATE_ERROR(options.addOption(
162 createValueOption(
"outputpath", 0,
"PATH",
163 "set the output file path. A file name, an incrementing index and the file extension"
164 " will be appended. E.g. setting 'folder/' will result in 'folder/image0.jpg' or "
165 "'folder/video0.mp4'. '/dev/null' can be used to discard output.",
169 PROPAGATE_ERROR(options.addOption(
170 createValueOption(
"denoise", 0,
"MODE",
"set the denoising mode.",
172 PROPAGATE_ERROR(options.addOption(
173 createValueOption(
"denoisestrength", 0,
"POSITION",
"set the denoising strength.",
175 PROPAGATE_ERROR(options.addOption(
176 createValueOption(
"edgeenhance", 0,
"MODE",
"set the edge enhancement mode.",
178 PROPAGATE_ERROR(options.addOption(
179 createValueOption(
"edgeenhancestrength", 0,
"POSITION",
180 "set the edge enhancement strength.",
184 PROPAGATE_ERROR(options.addOption(
185 createValueOption(
"aeantibanding", 0,
"MODE",
"set the auto exposure antibanding mode.",
187 PROPAGATE_ERROR(options.addOption(
188 createValueOption(
"aelock", 0,
"LOCK",
"set the auto exposure lock.",
190 PROPAGATE_ERROR(options.addOption(
191 createValueOption(
"awblock", 0,
"LOCK",
"set the auto white balance lock.",
193 PROPAGATE_ERROR(options.addOption(
194 createValueOption(
"awb", 0,
"MODE",
"set the auto white balance mode.",
196 PROPAGATE_ERROR(options.addOption(
197 createValueOption(
"exposurecompensation", 0,
"COMPENSATION",
198 "set the exposure compensation to COMPENSATION.",
200 PROPAGATE_ERROR(options.addOption(
201 createValueOption(
"ispdigitalgainrange", 0,
"RANGE",
202 "sets the ISP digital gain range.",
208 PROPAGATE_ERROR(options.addOption(
209 createValueOption(
"defog", 0,
"ENABLE",
210 "set the DeFog enable flag to ENABLE.",
212 PROPAGATE_ERROR(options.addOption(
213 createValueOption(
"defogamount", 0,
"AMOUNT",
214 "sets the amount of fog to be removed to AMOUNT.",
216 PROPAGATE_ERROR(options.addOption(
217 createValueOption(
"defogquality", 0,
"QUALITY",
218 "sets the quality of the DeFog effect to QUALITY.",
232 PROPAGATE_ERROR_CONTINUE(
stop());
243 Window::IGuiContainer *iGuiContainerConfig)
252 UniquePointer<Window::IGuiMenu> menu;
253 UniquePointer<Window::IGuiMenuItem> item;
256 Window::IGuiMenu *fileMenu = iGuiMenuBar->getMenu(
"File");
259 PROPAGATE_ERROR(Window::IGuiMenu::create(
"File", &menu));
260 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
261 fileMenu = menu.get();
266 PROPAGATE_ERROR(fileMenu->add(item.get()));
270 PROPAGATE_ERROR(fileMenu->add(item.get()));
274 PROPAGATE_ERROR(fileMenu->add(item.get()));
277 Window::IGuiMenu *helpMenu = iGuiMenuBar->getMenu(
"Help");
280 PROPAGATE_ERROR(Window::IGuiMenu::create(
"Help", &menu));
281 PROPAGATE_ERROR(iGuiMenuBar->add(menu.get()));
282 helpMenu = menu.get();
287 PROPAGATE_ERROR(helpMenu->add(item.get()));
298 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
301 UniquePointer<Window::IGuiElement> element;
304 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
306 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
307 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
308 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
311 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
312 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
313 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
314 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
315 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
318 #define CREATE_GUI_ELEMENT_PATH_CHOOSER(_NAME, _VALUE) \
319 PROPAGATE_ERROR(Window::IGuiElement::createFileChooser(&dispatcher._VALUE, \
321 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
333 uint32_t, Window::IGuiElement::ValueTypeEnum);
335 Argus::PixelFormat, Argus::NamedUUID);
343 Argus::DenoiseMode, Argus::NamedUUID);
346 Argus::EdgeEnhanceMode, Argus::NamedUUID);
350 Argus::AeAntibandingMode, Argus::NamedUUID);
355 Argus::AwbMode, Argus::NamedUUID);
358 #undef CREATE_GUI_ELEMENT
359 #undef CREATE_GUI_ELEMENT_COMBO_BOX
360 #undef CREATE_GUI_ELEMENT_PATH_CHOOSER