40 #include "UniquePointer.h"
44 #include "Validator.h"
45 #include <Argus/Ext/BayerSharpnessMap.h>
46 #include <Argus/Ext/DebugCaptureSession.h>
47 #include <Argus/Ext/DeFog.h>
48 #include <Argus/Ext/FaceDetect.h>
49 #include <Argus/Ext/InternalFrameCount.h>
50 #include <Argus/Ext/SensorPrivateMetadata.h>
51 #include <Argus/Ext/DebugCaptureSession.h>
52 #include <Argus/Ext/PwlWdrSensorMode.h>
53 #include <Argus/Ext/DolWdrSensorMode.h>
55 namespace ArgusSamples
71 virtual bool isInterface(Argus::Interface *interface)
const = 0;
85 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_denoiseMode.registerObserver(
this,
86 static_cast<IObserver::CallbackFunction>(
89 static_cast<IObserver::CallbackFunction>(
98 static_cast<IObserver::CallbackFunction>(
100 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_denoiseMode.unregisterObserver(
this,
101 static_cast<IObserver::CallbackFunction>(
118 ORIGINATE_ERROR(
"Failed to set the denoising mode");
134 ORIGINATE_ERROR(
"Failed to set the denoise strength");
157 static_cast<IObserver::CallbackFunction>(
160 static_cast<IObserver::CallbackFunction>(
169 static_cast<IObserver::CallbackFunction>(
172 static_cast<IObserver::CallbackFunction>(
191 ORIGINATE_ERROR(
"Failed to set the edge enhancement mode");
208 ORIGINATE_ERROR(
"Failed to set the edge enhancement strength");
232 static_cast<IObserver::CallbackFunction>(
234 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_gainRange.registerObserver(
this,
235 static_cast<IObserver::CallbackFunction>(
238 static_cast<IObserver::CallbackFunction>(
240 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_frameRate.registerObserver(
this,
241 static_cast<IObserver::CallbackFunction>(
244 static_cast<IObserver::CallbackFunction>(
246 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_focusPosition.registerObserver(
this,
247 static_cast<IObserver::CallbackFunction>(
250 static_cast<IObserver::CallbackFunction>(
252 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_apertureFnum.registerObserver(
this,
253 static_cast<IObserver::CallbackFunction>(
256 static_cast<IObserver::CallbackFunction>(
259 static_cast<IObserver::CallbackFunction>(
268 static_cast<IObserver::CallbackFunction>(
271 static_cast<IObserver::CallbackFunction>(
273 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_apertureFnum.unregisterObserver(
this,
274 static_cast<IObserver::CallbackFunction>(
276 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_focusPosition.unregisterObserver(
this,
277 static_cast<IObserver::CallbackFunction>(
279 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_frameRate.unregisterObserver(
this,
280 static_cast<IObserver::CallbackFunction>(
282 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_frameRateRange.unregisterObserver(
this,
283 static_cast<IObserver::CallbackFunction>(
286 static_cast<IObserver::CallbackFunction>(
288 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_gainRange.unregisterObserver(
this,
289 static_cast<IObserver::CallbackFunction>(
292 static_cast<IObserver::CallbackFunction>(
295 static_cast<IObserver::CallbackFunction>(
314 ORIGINATE_ERROR(
"Failed to set exposure time range");
329 ORIGINATE_ERROR(
"Failed to set gain range");
342 Argus::SensorMode *sensorMode = NULL;
346 ORIGINATE_ERROR(
"Failed to set sensor mode");
376 ORIGINATE_ERROR(
"Failed to set focus position");
393 ORIGINATE_ERROR(
"Failed to set aperture motor step");
410 ORIGINATE_ERROR(
"Failed to set aperture F-num");
427 ORIGINATE_ERROR(
"Failed to set aperture motor speed");
441 Argus::Range<uint64_t> frameDurationRangeNs(0);
443 const float epValue = std::numeric_limits<float>::epsilon();
448 frameDurationRangeNs =
455 Argus::SensorMode *sensorMode = NULL;
459 Argus::ISensorMode *iSensorMode =
460 Argus::interface_cast<Argus::ISensorMode>(sensorMode);
462 frameDurationRangeNs = iSensorMode->getFrameDurationRange();
465 if (
m_iSourceSettings->setFrameDurationRange(frameDurationRangeNs) != Argus::STATUS_OK)
466 ORIGINATE_ERROR(
"Failed to set frame duration range");
479 Argus::Range<uint64_t> frameDurationRangeNs(0);
481 const float epValue = std::numeric_limits<float>::epsilon();
487 frameDurationRangeNs =
497 Argus::SensorMode *sensorMode = NULL;
501 Argus::ISensorMode *iSensorMode =
502 Argus::interface_cast<Argus::ISensorMode>(sensorMode);
504 frameDurationRangeNs = iSensorMode->getFrameDurationRange();
507 if (
m_iSourceSettings->setFrameDurationRange(frameDurationRangeNs) != Argus::STATUS_OK)
508 ORIGINATE_ERROR(
"Failed to set frame duration range");
531 static_cast<IObserver::CallbackFunction>(
533 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_aeLock.registerObserver(
this,
534 static_cast<IObserver::CallbackFunction>(
536 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbLock.registerObserver(
this,
537 static_cast<IObserver::CallbackFunction>(
539 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbMode.registerObserver(
this,
540 static_cast<IObserver::CallbackFunction>(
543 static_cast<IObserver::CallbackFunction>(
546 static_cast<IObserver::CallbackFunction>(
549 static_cast<IObserver::CallbackFunction>(
552 static_cast<IObserver::CallbackFunction>(
561 static_cast<IObserver::CallbackFunction>(
564 static_cast<IObserver::CallbackFunction>(
566 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbMode.unregisterObserver(
this,
567 static_cast<IObserver::CallbackFunction>(
569 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbLock.unregisterObserver(
this,
570 static_cast<IObserver::CallbackFunction>(
572 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_aeLock.unregisterObserver(
this,
573 static_cast<IObserver::CallbackFunction>(
576 static_cast<IObserver::CallbackFunction>(
579 static_cast<IObserver::CallbackFunction>(
582 static_cast<IObserver::CallbackFunction>(
601 ORIGINATE_ERROR(
"Failed to set the AE antibanding mode");
613 assert(&source == &dispatcher.
m_aeLock);
616 ORIGINATE_ERROR(
"Failed to set the AE lock");
627 assert(&source == &dispatcher.
m_awbLock);
630 ORIGINATE_ERROR(
"Failed to set the AWB lock");
641 assert(&source == &dispatcher.
m_awbMode);
644 ORIGINATE_ERROR(
"Failed to set the AWB mode");
660 ORIGINATE_ERROR(
"Failed to set the exposure compensation");
677 ORIGINATE_ERROR(
"Failed to set the Isp Digital Gain Range");
694 if ((horizontal.min() < horizontal.max()) &&
695 vertical.min() < vertical.max())
698 Argus::Rectangle<uint32_t> histRegion(horizontal.min(), vertical.min(),
699 horizontal.max(), vertical.max());
703 ORIGINATE_ERROR(
"Failed to set the bayer histogram region");
707 std::vector<Argus::AcRegion> afRegions;
708 Argus::AcRegion oneRegion(horizontal.min(), vertical.min(), horizontal.max(),
709 vertical.max(), 1.0f);
710 afRegions.push_back(oneRegion);
714 ORIGINATE_ERROR(
"Failed to set the af region");
738 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogEnable.registerObserver(
this,
740 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogAmount.registerObserver(
this,
742 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogQuality.registerObserver(
this,
750 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogQuality.unregisterObserver(
this,
752 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogAmount.unregisterObserver(
this,
754 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogEnable.unregisterObserver(
this,
784 ORIGINATE_ERROR(
"Failed to set the DeFog amount");
798 ORIGINATE_ERROR(
"Failed to set the DeFog quality");
809 static const ValidatorEnum<Argus::PixelFormat>::ValueStringPair s_captureYuvFormatTypes[] =
811 { Argus::PIXEL_FMT_YCbCr_420_888,
"nv12" },
812 { Argus::PIXEL_FMT_YCbCr_444_888,
"nv24" },
813 { Argus::PIXEL_FMT_P016,
"p016" }
817 static const ValidatorEnum<Argus::DenoiseMode>::ValueStringPair s_denoiseModes[] =
819 { Argus::DENOISE_MODE_OFF,
"off" },
820 { Argus::DENOISE_MODE_FAST,
"fast" },
821 { Argus::DENOISE_MODE_HIGH_QUALITY,
"highquality" }
825 static const ValidatorEnum<Argus::EdgeEnhanceMode>::ValueStringPair s_edgeEnhanceModes[] =
827 { Argus::EDGE_ENHANCE_MODE_OFF,
"off" },
828 { Argus::EDGE_ENHANCE_MODE_FAST,
"fast" },
829 { Argus::EDGE_ENHANCE_MODE_HIGH_QUALITY,
"highquality" }
833 static const ValidatorEnum<Argus::AeAntibandingMode>::ValueStringPair s_aeAntibandingModes[] =
835 { Argus::AE_ANTIBANDING_MODE_OFF,
"off" },
836 { Argus::AE_ANTIBANDING_MODE_AUTO,
"auto" },
837 { Argus::AE_ANTIBANDING_MODE_50HZ,
"50hz" },
838 { Argus::AE_ANTIBANDING_MODE_60HZ,
"60hz" }
842 static const ValidatorEnum<Argus::AwbMode>::ValueStringPair s_awbModes[] =
844 { Argus::AWB_MODE_OFF,
"off" },
845 { Argus::AWB_MODE_AUTO,
"auto" },
846 { Argus::AWB_MODE_INCANDESCENT,
"incandescent" },
847 { Argus::AWB_MODE_FLUORESCENT,
"fluorescent" },
848 { Argus::AWB_MODE_WARM_FLUORESCENT,
"warmfluorescent" },
849 { Argus::AWB_MODE_DAYLIGHT,
"daylight" },
850 { Argus::AWB_MODE_CLOUDY_DAYLIGHT,
"cloudydaylight" },
851 { Argus::AWB_MODE_TWILIGHT,
"twilight" },
852 { Argus::AWB_MODE_SHADE,
"shade" }
856 static const ValidatorEnum<ArgusSamples::StillFileType>::ValueStringPair s_stillFileTypes[] =
863 static const ValidatorEnum<VideoPipeline::VideoFormat>::ValueStringPair s_videoFormats[] =
872 static const ValidatorEnum<VideoPipeline::VideoFileType>::ValueStringPair s_videoFileTypes[] =
882 static const ValidatorEnum<
890 static const Argus::Size2D<uint32_t> s_outputSizes[] =
892 Argus::Size2D<uint32_t>(0, 0),
893 Argus::Size2D<uint32_t>(176, 144),
894 Argus::Size2D<uint32_t>(320, 240),
895 Argus::Size2D<uint32_t>(640, 480),
896 Argus::Size2D<uint32_t>(1280, 720),
897 Argus::Size2D<uint32_t>(1920, 1080),
898 Argus::Size2D<uint32_t>(3840, 2160),
902 : m_deviceFocusPositionRange(0)
903 , m_deviceAperturePositionRange(0)
904 , m_deviceApertureMotorSpeedRange(1.0f)
905 , m_deviceExposureCompensationRange(0.0f)
906 , m_deviceIspDigitalGainRange(Argus::Range<float>(0.0f))
907 , m_sensorExposureTimeRange(Argus::Range<uint64_t>(0))
908 , m_sensorAnalogGainRange(Argus::Range<float>(0.0f))
909 , m_sensorFrameRateRange(0.0f)
910 , m_sensorFrameRateRangeLimits(Argus::Range<float>(0.0f))
911 , m_deviceIndex(new ValidatorStdVector<uint32_t, Argus::CameraDevice*>(&m_cameraDevices), 0)
912 , m_deviceOpen(false)
913 , m_sensorModeValid(false)
916 , m_exposureTimeRange(new ValidatorRange<Argus::Range<uint64_t> >(&m_sensorExposureTimeRange),
917 Argus::Range<uint64_t>(0))
918 , m_gainRange(new ValidatorRange<Argus::Range<float> >(&m_sensorAnalogGainRange),
919 Argus::Range<float>(0.0f))
920 , m_sensorModeIndex(new ValidatorEnum<uint32_t>(), 0)
921 , m_frameRate(new ValidatorRange<float>(&m_sensorFrameRateRange), 0.0f)
922 , m_frameRateRange(new ValidatorRange<Argus::Range<float> >(&m_sensorFrameRateRangeLimits),
923 Argus::Range<float>(0.0f))
924 , m_focusPosition(new ValidatorRange<int32_t>(&m_deviceFocusPositionRange), 0)
925 , m_aperturePosition(new ValidatorRange<int32_t>(&m_deviceAperturePositionRange), 0)
926 , m_apertureFnum(new ValidatorEnum<float>(), 0.0f)
927 , m_apertureMotorSpeed(new ValidatorRange<float>(&m_deviceApertureMotorSpeedRange), 1.0f)
928 , m_captureYuvFormat(new ValidatorEnum<Argus::PixelFormat>(
929 s_captureYuvFormatTypes,
930 sizeof(s_captureYuvFormatTypes) / sizeof(s_captureYuvFormatTypes[0])),
931 Argus::PIXEL_FMT_YCbCr_420_888)
932 , m_denoiseMode(new ValidatorEnum<Argus::DenoiseMode>(
933 s_denoiseModes, sizeof(s_denoiseModes) / sizeof(s_denoiseModes[0])),
934 Argus::DENOISE_MODE_FAST)
935 , m_denoiseStrength(new ValidatorRange<float>(-1.0f, 1.0f), -1.0f)
936 , m_edgeEnhanceMode(new ValidatorEnum<Argus::EdgeEnhanceMode>(
937 s_edgeEnhanceModes, sizeof(s_edgeEnhanceModes) / sizeof(s_edgeEnhanceModes[0])),
938 Argus::EDGE_ENHANCE_MODE_FAST)
939 , m_edgeEnhanceStrength(new ValidatorRange<float>(-1.0f, 1.0f), -1.0f)
940 , m_aeAntibandingMode(new ValidatorEnum<Argus::AeAntibandingMode>(
941 s_aeAntibandingModes, sizeof(s_aeAntibandingModes) / sizeof(s_aeAntibandingModes[0])),
942 Argus::AE_ANTIBANDING_MODE_AUTO)
945 , m_awbMode(new ValidatorEnum<Argus::AwbMode>(
946 s_awbModes, sizeof(s_awbModes) / sizeof(s_awbModes[0])),
947 Argus::AWB_MODE_AUTO)
948 , m_exposureCompensation(new ValidatorRange<float>(&m_deviceExposureCompensationRange), 0.0f)
949 , m_ispDigitalGainRange(new ValidatorRange<Argus::Range<float> >(&m_deviceIspDigitalGainRange),
950 Argus::Range<float>(1.0f))
951 , m_acRegionHorizontal(Argus::Range<uint32_t>(0))
952 , m_acRegionVertical(Argus::Range<uint32_t>(0))
954 s_stillFileTypes, sizeof(s_stillFileTypes) / sizeof(s_stillFileTypes[0])),
956 , m_videoFormat(new ValidatorEnum<
VideoPipeline::VideoFormat>(
957 s_videoFormats, sizeof(s_videoFormats) / sizeof(s_videoFormats[0])),
959 , m_videoFileType(new ValidatorEnum<
VideoPipeline::VideoFileType>(
960 s_videoFileTypes, sizeof(s_videoFileTypes) / sizeof(s_videoFileTypes[0])),
962 , m_videoBitRate(new ValidatorRange<uint32_t>(0,
VideoPipeline::VIDEO_BITRATE_MAX),0)
963 , m_videoControlRate(new ValidatorEnum<
VideoPipeline::VideoControlRateMode>(
964 s_videoControlRateModes,
965 sizeof(s_videoControlRateModes) / sizeof(s_videoControlRateModes[0])),
967 , m_videoTwoPassCBREnable(false)
968 , m_outputSize(new ValidatorSize2D<uint32_t>(s_outputSizes,
969 sizeof(s_outputSizes) / sizeof(s_outputSizes[0]), true ),
970 Argus::Size2D<uint32_t>(0, 0))
972 , m_deFogEnable(false)
973 , m_deFogAmount(new ValidatorRange<float>(0.0f, 1.0f), 0.9f)
974 , m_deFogQuality(new ValidatorRange<float>(0.0f, 1.0f), 0.14285f)
975 , m_initialized(false)
976 , m_iCameraProvider(NULL)
984 REPORT_ERROR(
"Failed to shutdown");
989 static InitOnce initOnce;
992 if (initOnce.begin())
1001 REPORT_ERROR(
"Initalization failed");
1014 m_cameraProvider = Argus::UniqueObj<Argus::CameraProvider>(Argus::CameraProvider::create());
1016 if (!m_iCameraProvider)
1017 ORIGINATE_ERROR(
"Failed to create CameraProvider");
1018 printf(
"Argus Version: %s\n", m_iCameraProvider->getVersion().c_str());
1025 ORIGINATE_ERROR(
"No cameras available");
1032 PROPAGATE_ERROR_CONTINUE(
m_deviceIndex.registerObserver(
this,
1048 PROPAGATE_ERROR_CONTINUE(
m_deviceIndex.unregisterObserver(
this,
1062 assert(
static_cast<const Value<uint32_t>&
>(source).
get() ==
m_deviceIndex);
1076 const Argus::ICameraProperties *iCameraProperties =
1078 if (!iCameraProperties)
1079 ORIGINATE_ERROR(
"Failed to get ICameraProperties interface");
1082 if (iCameraProperties->getAllSensorModes(&
m_sensorModes) != Argus::STATUS_OK)
1083 ORIGINATE_ERROR(
"Failed to get sensor modes");
1086 ORIGINATE_ERROR(
"No sensor modes found");
1096 ORIGINATE_ERROR(
"Failed to get Aperture Fnum");
1098 ValidatorEnum<float>* apertureFnumValidator =
1099 static_cast<ValidatorEnum<float>*
>(
m_apertureFnum.getValidator());
1108 Argus::Range<float> digitalGainRange = iCameraProperties->getIspDigitalGainRange();
1109 Argus::Range<float> deviceExposureCompensationRange =
1110 iCameraProperties->getExposureCompensationRange();
1118 Argus::Range<float> unifiedDigitalGainRange(0);
1119 unifiedDigitalGainRange.min() =
1121 unifiedDigitalGainRange.max() =
1124 Argus::Range<float> unifiedExposureCompensationRange(0);
1125 unifiedExposureCompensationRange.min() =
1127 deviceExposureCompensationRange.min());
1128 unifiedExposureCompensationRange.max() =
1130 deviceExposureCompensationRange.max());
1133 Argus::Range<Argus::Range<float> >(unifiedDigitalGainRange)));
1135 Argus::Range<float> (unifiedExposureCompensationRange)));
1143 digitalGainRange, digitalGainRange)));
1145 deviceExposureCompensationRange)));
1148 std::vector<ValidatorEnum<uint32_t>::ValueStringPair> valueStringPairs;
1150 for (
size_t index = 0; index <
m_sensorModes.size(); ++index)
1152 Argus::ISensorMode *sensorMode =
1153 Argus::interface_cast<Argus::ISensorMode>(
m_sensorModes[index]);
1155 valueStringPairs[index].value = (uint32_t)index;
1157 std::ostringstream stream;
1158 stream << index <<
": "
1159 << sensorMode->getResolution().width() <<
"x" << sensorMode->getResolution().height();
1161 Argus::Ext::IPwlWdrSensorMode* pwlMode =
1162 Argus::interface_cast<Argus::Ext::IPwlWdrSensorMode>(
m_sensorModes[index]);
1164 Argus::Ext::IDolWdrSensorMode* dolMode =
1165 Argus::interface_cast<Argus::Ext::IDolWdrSensorMode>(
m_sensorModes[index]);
1168 stream <<
" @" << sensorMode->getInputBitDepth() <<
"bpp -> " <<
1169 sensorMode->getOutputBitDepth() <<
"bpp";
1173 stream <<
" @" << sensorMode->getOutputBitDepth() <<
"bpp -> " <<
1174 dolMode->getExposureCount() <<
" exposure" <<
" DOL WDR";
1178 stream <<
" @" << sensorMode->getOutputBitDepth() <<
"bpp";
1181 valueStringPairs[index].string = stream.str();
1184 ValidatorEnum<uint32_t> *validator =
1186 PROPAGATE_ERROR(validator->setValidValues(valueStringPairs.data(), valueStringPairs.size()));
1203 Argus::ISensorMode *iSensorMode =
1206 ORIGINATE_ERROR(
"Failed to get ISensorMode interface");
1209 Argus::Range<uint64_t> sensorExposureTimeRange = iSensorMode->getExposureTimeRange();
1210 Argus::Range<float> sensorAnalogGainRange = iSensorMode->getAnalogGainRange();
1211 Argus::Range<TimeValue> sensorFrameDurationRange(
1214 Argus::Range<float> sensorFrameRateRange(
1215 sensorFrameDurationRange.max().toCyclesPerSec(),
1216 sensorFrameDurationRange.min().toCyclesPerSec());
1219 Argus::Range<uint64_t> unifiedSensorExposureTimeRange(0);
1220 unifiedSensorExposureTimeRange.min() =
1222 unifiedSensorExposureTimeRange.max() =
1224 Argus::Range<float> unifiedSensorAnalogGainRange(0);
1225 unifiedSensorAnalogGainRange.min() =
1227 unifiedSensorAnalogGainRange.max() =
1229 Argus::Range<float> unifiedSensorFrameRateRange(0.0f);
1230 unifiedSensorFrameRateRange.min() =
1232 unifiedSensorFrameRateRange.max() =
1236 Argus::Range<Argus::Range<uint64_t> >(unifiedSensorExposureTimeRange)));
1238 Argus::Range<Argus::Range<float> >(unifiedSensorAnalogGainRange)));
1244 PROPAGATE_ERROR(
m_gainRange.set(sensorAnalogGainRange));
1248 Argus::Range<float> frameRateRangeSetting (0.0f);
1249 frameRateRangeSetting.min() = sensorFrameRateRange.max();
1250 frameRateRangeSetting.max() = sensorFrameRateRange.max();
1253 PROPAGATE_ERROR(
m_frameRate.set(sensorFrameRateRange.max()));
1257 sensorExposureTimeRange, sensorExposureTimeRange)));
1259 sensorAnalogGainRange, sensorAnalogGainRange)));
1262 sensorFrameRateRange, sensorFrameRateRange)));
1275 std::ostringstream stream;
1279 stream <<
"Argus extensions:" << std::endl;
1280 stream <<
" BayerSharpnessMap: " <<
1282 "supported" :
"not supported") << std::endl;
1283 stream <<
" DebugCaptureSession: " <<
1285 "supported" :
"not supported") << std::endl;
1286 stream <<
" DeFog: " <<
1288 "supported" :
"not supported") << std::endl;
1289 stream <<
" FaceDetect: " <<
1291 "supported" :
"not supported") << std::endl;
1292 stream <<
" InternalFrameCount: " <<
1294 "supported" :
"not supported") << std::endl;
1295 stream <<
" SensorPrivateMetadata: " <<
1297 "supported" :
"not supported") << std::endl;
1299 stream <<
"Number of camera devices: " <<
m_cameraDevices.size() << std::endl;
1301 for (uint32_t deviceIndex = 0; deviceIndex <
m_cameraDevices.size(); ++deviceIndex)
1303 stream <<
"Device: " << deviceIndex << std::endl;
1305 const Argus::ICameraProperties *iCameraProperties =
1306 Argus::interface_cast<Argus::ICameraProperties>(
m_cameraDevices[deviceIndex]);
1307 if (!iCameraProperties)
1308 ORIGINATE_ERROR(
"Failed to get ICameraProperties interface");
1310 stream <<
" Max AE Regions: " <<
1311 iCameraProperties->getMaxAeRegions() << std::endl;
1312 stream <<
" Max AWB Regions: " <<
1313 iCameraProperties->getMaxAwbRegions() << std::endl;
1314 stream <<
" Focus Position Range: " <<
1315 iCameraProperties->getFocusPositionRange().min() <<
" - " <<
1316 iCameraProperties->getFocusPositionRange().max() << std::endl;
1317 stream <<
" Aperture Position Range: " <<
1318 iCameraProperties->getAperturePositionRange().min() <<
" - " <<
1319 iCameraProperties->getAperturePositionRange().max() << std::endl;
1320 stream <<
" Aperture Motor Speed Range: " <<
1321 iCameraProperties->getApertureMotorSpeedRange().min() <<
" - " <<
1322 iCameraProperties->getApertureMotorSpeedRange().max() << std::endl;
1323 stream <<
" Lens Aperture Available values: ";
1324 std::vector<float> availableFnums;
1325 iCameraProperties->getAvailableApertureFNumbers(&availableFnums);
1326 for (std::vector<float>::iterator it = availableFnums.begin();
1327 it != availableFnums.end(); ++it)
1329 stream << *it <<
", ";
1331 stream << std::endl;
1333 stream <<
" Isp Digital Gain Range: " <<
1334 iCameraProperties->getIspDigitalGainRange().min() <<
" - " <<
1335 iCameraProperties->getIspDigitalGainRange().max() << std::endl;
1338 std::vector<Argus::SensorMode*> sensorModes;
1339 iCameraProperties->getAllSensorModes(&sensorModes);
1340 stream <<
" Number of sensor modes: " << sensorModes.size() << std::endl;
1341 for (uint32_t sensorModeIndex = 0; sensorModeIndex < sensorModes.size(); ++sensorModeIndex)
1343 Argus::ISensorMode *sensorMode =
1344 Argus::interface_cast<Argus::ISensorMode>(sensorModes[sensorModeIndex]);
1346 ORIGINATE_ERROR(
"Failed to get ISensorMode interface");
1350 sensorMode->getFrameDurationRange().min()).toCyclesPerSec();
1352 sensorMode->getFrameDurationRange().max()).toCyclesPerSec();
1354 stream <<
" Sensor mode: " << sensorModeIndex << std::endl;
1355 stream <<
" Resolution: " <<
1356 sensorMode->getResolution().width() <<
"x" <<
1357 sensorMode->getResolution().height() << std::endl;
1358 stream <<
" Exposure time range: " <<
1359 sensorMode->getExposureTimeRange().min() <<
" - " <<
1360 sensorMode->getExposureTimeRange().max() <<
" ns" << std::endl;
1361 stream <<
" Frame duration range: " <<
1362 sensorMode->getFrameDurationRange().min() <<
" - " <<
1363 sensorMode->getFrameDurationRange().max() <<
" ns" << std::endl;
1364 stream <<
" Framerate range: " <<
1365 minimum_fps <<
" - " <<
1366 maximum_fps <<
" fps" << std::endl;
1367 stream <<
" InputBitDepth: " <<
1368 sensorMode->getInputBitDepth() << std::endl;
1369 stream <<
" OutputBitDepth: " <<
1370 sensorMode->getOutputBitDepth() << std::endl;
1371 stream <<
" Analog gain range: " <<
1372 sensorMode->getAnalogGainRange().min() <<
" - " <<
1373 sensorMode->getAnalogGainRange().max() << std::endl;
1375 stream <<
" SensorModeType: " <<
1376 sensorMode->getSensorModeType().getName() << std::endl;
1378 Argus::Ext::IPwlWdrSensorMode* pwlMode =
1379 Argus::interface_cast<Argus::Ext::IPwlWdrSensorMode>(sensorModes[sensorModeIndex]);
1381 Argus::Ext::IDolWdrSensorMode* dolMode =
1382 Argus::interface_cast<Argus::Ext::IDolWdrSensorMode>(sensorModes[sensorModeIndex]);
1386 stream <<
" Piecewise Linear (PWL) WDR Extension supported with: " <<
1387 pwlMode->getControlPointCount() <<
" control points." << std::endl;
1388 std::vector< Argus::Point2D<float> > points;
1389 Argus::Status status = pwlMode->getControlPoints(&points);
1390 if (status != Argus::STATUS_OK)
1391 ORIGINATE_ERROR(
"Error obtaining control points");
1392 stream <<
" - Control Points: " << std::endl;
1393 for (uint32_t j = 0; j < pwlMode->getControlPointCount(); j++)
1395 stream <<
" (" << points[j].x() <<
", " <<
1396 points[j].y() <<
")" << std::endl;
1401 stream <<
" Digital Overlap (DOL) WDR Extension supported with: " << std::endl <<
1402 " - Number of Exposures: " <<
1403 dolMode->getExposureCount() << std::endl <<
1404 " - Number of Optical Black Lines per exposure: " <<
1405 dolMode->getOpticalBlackRowCount() << std::endl <<
1406 " - Number of Line Info marker pixels per row per exposure: " <<
1407 dolMode->getLineInfoMarkerWidth() << std::endl <<
1408 " - Number of margin pixels on left per row per exposure: " <<
1409 dolMode->getLeftMarginWidth() << std::endl <<
1410 " - Number of margin pixels on right per row per exposure: " <<
1411 dolMode->getRightMarginWidth() << std::endl;
1413 std::vector<u_int32_t> verticalBlankPeriodRowCounts;
1414 Argus::Status status =
1415 dolMode->getVerticalBlankPeriodRowCount(&verticalBlankPeriodRowCounts);
1416 if (status != Argus::STATUS_OK)
1417 ORIGINATE_ERROR(
"Error obtaining vertical blank period offsets per exposure");
1418 stream <<
" - Vertical blank period section row counts per exposure: "
1420 for (uint32_t j = 0; j < verticalBlankPeriodRowCounts.size(); j++)
1422 stream <<
" - VBP-section[" << j <<
"] : "
1423 << verticalBlankPeriodRowCounts[j] << std::endl;
1426 stream <<
" - Physical Resolution: " <<
1427 dolMode->getPhysicalResolution().width() <<
"x" <<
1428 dolMode->getPhysicalResolution().height() << std::endl;
1431 stream << std::endl;
1435 info = stream.str();
1445 ORIGINATE_ERROR(
"Invalid sensor mode index");
1475 uint32_t deviceIndex)
1480 ORIGINATE_ERROR(
"Invalid device index");
1487 Argus::UniqueObj<Argus::CaptureSession> newSession(
1490 ORIGINATE_ERROR(
"Failed to create CaptureSession");
1492 PROPAGATE_ERROR(session.
reset(newSession.release(),
this));
1502 Argus::Ext::IDebugCaptureSession *iDebugCaptureSession =
1503 Argus::interface_cast<Argus::Ext::IDebugCaptureSession>(it->m_session);
1504 if (!iDebugCaptureSession)
1505 ORIGINATE_ERROR(
"DebugCaptureSession extension not supported");
1507 const Argus::Status status = iDebugCaptureSession->dump(STDOUT_FILENO);
1508 if (status != Argus::STATUS_OK)
1509 ORIGINATE_ERROR(
"Failed to get dump runtime info");
1548 if (it->m_session == session)
1555 ORIGINATE_ERROR(
"Session not found");
1559 Argus::CaptureSession *session)
1568 Argus::IEventProvider *iEventProvider = Argus::interface_cast<Argus::IEventProvider>(session);
1569 if (!iEventProvider)
1570 ORIGINATE_ERROR(
"Failed to get iEventProvider interface");
1573 const Argus::Status status = iEventProvider->waitForEvents(eventQueue, timeout.
toNSec());
1574 if ((status != Argus::STATUS_OK) && (status != Argus::STATUS_TIMEOUT))
1575 ORIGINATE_ERROR(
"Failed to get events");
1581 Argus::CaptureIntent captureIntent, Argus::CaptureSession *session)
1590 Argus::ICaptureSession *iCaptureSession =
1591 Argus::interface_cast<Argus::ICaptureSession>(session);
1592 if (!iCaptureSession)
1593 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1596 Argus::UniqueObj<Argus::Request> newRequest =
1597 Argus::UniqueObj<Argus::Request>(iCaptureSession->createRequest(captureIntent));
1599 ORIGINATE_ERROR(
"Failed to create request");
1602 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(newRequest);
1604 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1607 Argus::ISourceSettings *iSourceSettings =
1608 Argus::interface_cast<Argus::ISourceSettings>(iRequest->getSourceSettings());
1609 if (!iSourceSettings)
1610 ORIGINATE_ERROR(
"Failed to get ISourceSettings interface");
1616 Argus::IAutoControlSettings *iAutoControlSettings =
1617 Argus::interface_cast<Argus::IAutoControlSettings>(iRequest->getAutoControlSettings());
1618 if (!iAutoControlSettings)
1619 ORIGINATE_ERROR(
"Failed to get IAutoControlSettings interface");
1625 Argus::IDenoiseSettings *iDenoiseSettings =
1626 Argus::interface_cast<Argus::IDenoiseSettings>(newRequest);
1627 if (!iDenoiseSettings)
1628 ORIGINATE_ERROR(
"Failed to get IDenoiseSettings interface");
1632 Argus::IEdgeEnhanceSettings *iEdgeEnhanceSettings =
1633 Argus::interface_cast<Argus::IEdgeEnhanceSettings>(newRequest);
1634 if (!iEdgeEnhanceSettings)
1635 ORIGINATE_ERROR(
"Failed to get IEdgeEnhanceSettings interface");
1641 Argus::Ext::IDeFogSettings *iDeFogSettings =
1642 Argus::interface_cast<Argus::Ext::IDeFogSettings>(newRequest);
1650 PROPAGATE_ERROR(request.
reset(newRequest.release(),
this));
1662 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1664 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1667 Argus::ISourceSettings *iSourceSettings =
1668 Argus::interface_cast<Argus::ISourceSettings>(iRequest->getSourceSettings());
1669 if (!iSourceSettings)
1670 ORIGINATE_ERROR(
"Failed to get ISourceSettings interface");
1676 Argus::IAutoControlSettings *iAutoControlSettings =
1677 Argus::interface_cast<Argus::IAutoControlSettings>(iRequest->getAutoControlSettings());
1678 if (!iAutoControlSettings)
1679 ORIGINATE_ERROR(
"Failed to get IAutoControlSettings interface");
1685 Argus::IDenoiseSettings *iDenoiseSettings =
1686 Argus::interface_cast<Argus::IDenoiseSettings>(request);
1687 if (!iDenoiseSettings)
1688 ORIGINATE_ERROR(
"Failed to get IDenoiseSettings interface");
1692 Argus::IEdgeEnhanceSettings *iEdgeEnhanceSettings =
1693 Argus::interface_cast<Argus::IEdgeEnhanceSettings>(request);
1694 if (!iEdgeEnhanceSettings)
1695 ORIGINATE_ERROR(
"Failed to get IEdgeEnhanceSettings interface");
1701 Argus::Ext::IDeFogSettings *iDeFogSettings =
1702 Argus::interface_cast<Argus::Ext::IDeFogSettings>(request);
1714 Argus::UniqueObj<Argus::EventQueue>& eventQueue, Argus::CaptureSession *session)
1723 Argus::IEventProvider *iEventProvider =
1724 Argus::interface_cast<Argus::IEventProvider>(session);
1725 if (!iEventProvider)
1726 ORIGINATE_ERROR(
"Failed to get IEventProvider interface");
1728 Argus::EventQueue *newEventQueue = iEventProvider->createEventQueue(eventTypes);
1730 ORIGINATE_ERROR(
"Failed to create eventQueue");
1732 eventQueue.reset(newEventQueue);
1746 Argus::ICaptureSession *iCaptureSession =
1747 Argus::interface_cast<Argus::ICaptureSession>(session);
1748 if (!iCaptureSession)
1749 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1751 if (iCaptureSession->capture(request, Argus::TIMEOUT_INFINITE) == 0)
1752 ORIGINATE_ERROR(
"Failed to submit the still capture request");
1766 Argus::ICaptureSession *iCaptureSession =
1767 Argus::interface_cast<Argus::ICaptureSession>(session);
1768 if (!iCaptureSession)
1769 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1771 if (iCaptureSession->repeat(request) != Argus::STATUS_OK)
1772 ORIGINATE_ERROR(
"Failed to submit repeating capture request");
1779 if (it->m_session == session)
1781 it->m_requests.push_back(request);
1787 ORIGINATE_ERROR(
"Did not find the session in the list of active sessions");
1793 Argus::CaptureSession *session)
1802 Argus::ICaptureSession *iCaptureSession =
1803 Argus::interface_cast<Argus::ICaptureSession>(session);
1804 if (!iCaptureSession)
1805 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1807 if (iCaptureSession->repeatBurst(requestList) != Argus::STATUS_OK)
1808 ORIGINATE_ERROR(
"Failed to submit repeating burst request");
1815 if (it->m_session == session)
1817 it->m_requests.insert(it->m_requests.end(), requestList.begin(), requestList.end());
1823 ORIGINATE_ERROR(
"Did not find the session in the list of active sessions");
1837 Argus::ICaptureSession *iCaptureSession =
1838 Argus::interface_cast<Argus::ICaptureSession>(session);
1839 if (!iCaptureSession)
1840 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1842 iCaptureSession->stopRepeat();
1849 if (it->m_session == session)
1851 it->m_requests.clear();
1857 ORIGINATE_ERROR(
"Did not find the session in the list of active sessions");
1867 if (!it->m_requests.empty())
1869 Argus::ICaptureSession *iCaptureSession =
1870 Argus::interface_cast<Argus::ICaptureSession>(it->m_session);
1871 if (!iCaptureSession)
1872 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1874 iCaptureSession->stopRepeat();
1876 if (iCaptureSession->repeatBurst(it->m_requests) != Argus::STATUS_OK)
1877 ORIGINATE_ERROR(
"Failed to submit repeating burst request");
1893 Argus::ICaptureSession *iCaptureSession =
1894 Argus::interface_cast<Argus::ICaptureSession>(session);
1895 if (!iCaptureSession)
1897 REPORT_ERROR(
"Failed to get ICaptureSession interface");
1901 return iCaptureSession->maxBurstRequests();
1913 Argus::ICaptureSession *iCaptureSession =
1914 Argus::interface_cast<Argus::ICaptureSession>(session);
1915 if (!iCaptureSession)
1916 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1918 if (iCaptureSession->waitForIdle() != Argus::STATUS_OK)
1919 ORIGINATE_ERROR(
"Waiting for idle failed");
1932 Argus::ISensorMode *sensorMode =
1935 ORIGINATE_ERROR(
"Failed to get ISensorMode interface");
1936 *size = sensorMode->getResolution();
1947 Argus::UniqueObj<Argus::OutputStream> &stream, Argus::CaptureSession *session)
1956 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1958 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1960 Argus::Size2D<uint32_t> outputSize;
1963 Argus::ICaptureSession *iCaptureSession =
1964 Argus::interface_cast<Argus::ICaptureSession>(session);
1965 if (!iCaptureSession)
1966 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1968 Argus::UniqueObj<Argus::OutputStreamSettings> outputStreamSettings(
1969 iCaptureSession->createOutputStreamSettings(Argus::STREAM_TYPE_EGL));
1970 Argus::IEGLOutputStreamSettings* iEGLOutputStreamSettings =
1971 Argus::interface_cast<Argus::IEGLOutputStreamSettings>(outputStreamSettings);
1972 if (!iEGLOutputStreamSettings)
1973 ORIGINATE_ERROR(
"Failed to get IEGLOutputStreamSettings interface");
1976 iEGLOutputStreamSettings->setResolution(outputSize);
1978 iEGLOutputStreamSettings->setMetadataEnable(enableMetadata);
1980 Argus::UniqueObj<Argus::OutputStream> outputStream(
1981 iCaptureSession->createOutputStream(outputStreamSettings.get()));
1983 ORIGINATE_ERROR(
"Failed to create OutputStream");
1985 stream.reset(outputStream.release());
1992 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1994 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1997 if (iRequest->enableOutputStream(stream) != Argus::STATUS_OK)
1998 ORIGINATE_ERROR(
"Failed to enable the output stream");
2005 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
2007 ORIGINATE_ERROR(
"Failed to get IRequest interface");
2010 if (iRequest->disableOutputStream(stream) != Argus::STATUS_OK)
2011 ORIGINATE_ERROR(
"Failed to disable the output stream");
2018 UniquePointer<DenoiseSettingsObserver> denoiseSettings;
2021 if (!denoiseSettings)
2022 ORIGINATE_ERROR(
"Out of memory");
2024 m_observers.push_front(denoiseSettings.release());
2030 UniquePointer<EdgeEnhanceSettingsObserver> edgeEnhanceSettings;
2033 if (!edgeEnhanceSettings)
2034 ORIGINATE_ERROR(
"Out of memory");
2036 m_observers.push_front(edgeEnhanceSettings.release());
2042 UniquePointer<SourceSettingsObserver> sourceSettings;
2045 if (!sourceSettings)
2046 ORIGINATE_ERROR(
"Out of memory");
2054 UniquePointer<AutoControlSettingsObserver> autoControlSettings;
2057 if (!autoControlSettings)
2058 ORIGINATE_ERROR(
"Out of memory");
2060 m_observers.push_front(autoControlSettings.release());
2066 UniquePointer<DeFogSettingsObserver> deFogSettings;
2070 ORIGINATE_ERROR(
"Out of memory");
2078 for (std::list<IObserverForInterface*>::iterator it =
m_observers.begin();
2081 if ((*it)->isInterface(interface))
2089 ORIGINATE_ERROR(
"Observer not found");
2098 va_start(list, msg);
2100 if (vprintf(msg, list) < 0)
2103 ORIGINATE_ERROR(
"Failed to print message");