CameraDevice.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. /*
  2. * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of NVIDIA CORPORATION nor the names of its
  13. * contributors may be used to endorse or promote products derived
  14. * from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  24. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. /**
  29. * @file
  30. * <b>Libargus API: Camera Device API</b>
  31. *
  32. * @b Description: This file defines objects representing a single camera device.
  33. */
  34. #ifndef _ARGUS_CAMERA_DEVICE_H
  35. #define _ARGUS_CAMERA_DEVICE_H
  36. namespace Argus
  37. {
  38. /**
  39. * Object representing a single camera device.
  40. *
  41. * CameraDevices are provided by a CameraProvider and are used to
  42. * access the camera devices available within the system.
  43. * Each device is based on a single sensor or a set of synchronized sensors.
  44. *
  45. * @see ICameraProvider::getCameraDevices
  46. *
  47. * @defgroup ArgusCameraDevice CameraDevice
  48. * @ingroup ArgusObjects
  49. */
  50. class CameraDevice : public InterfaceProvider
  51. {
  52. protected:
  53. ~CameraDevice() {}
  54. };
  55. /**
  56. * @class ICameraProperties
  57. *
  58. * Interface to the core CameraDevice properties.
  59. *
  60. * @ingroup ArgusCameraDevice
  61. */
  62. DEFINE_UUID(InterfaceID, IID_CAMERA_PROPERTIES, 436d2a73,c85b,4a29,bce5,15,60,6e,35,86,91);
  63. class ICameraProperties : public Interface
  64. {
  65. public:
  66. static const InterfaceID& id() { return IID_CAMERA_PROPERTIES; }
  67. /**
  68. * Returns the camera UUID.
  69. *
  70. * In UUID, clock_seq contains low 16 bits of GUID,
  71. * node[6] contains high 48 bits of GUID.
  72. */
  73. virtual UUID getUUID() const = 0;
  74. /**
  75. * Returns the camera sensor placement position on the module.
  76. */
  77. virtual SensorPlacement getSensorPlacement() const = 0;
  78. /**
  79. * Returns the maximum number of regions of interest supported by AE.
  80. * A value of 0 means that the entire image is the only supported region of interest.
  81. *
  82. * @see IAutoControlSettings::setAeRegions()
  83. */
  84. virtual uint32_t getMaxAeRegions() const = 0;
  85. /**
  86. * Returns the minimum size of resultant region required by AE.
  87. *
  88. * @see IAutoControlSettings::setAeRegions()
  89. */
  90. virtual Size2D<uint32_t> getMinAeRegionSize() const = 0;
  91. /**
  92. * Returns the maximum number of regions of interest supported by AWB.
  93. * A value of 0 means that the entire image is the only supported region of interest.
  94. *
  95. * @see IAutoControlSettings::setAwbRegions()
  96. */
  97. virtual uint32_t getMaxAwbRegions() const = 0;
  98. /**
  99. * Returns the maximum number of regions of interest supported by AF.
  100. * A value of 0 means that the entire image is the only supported region of interest.
  101. *
  102. * @see IAutoControlSettings::setAfRegions()
  103. */
  104. virtual uint32_t getMaxAfRegions() const = 0;
  105. /**
  106. * Returns only the basic available sensor modes that do not have an associated
  107. * extension. Basic mode types include Depth, RGB, YUV and Bayer types.
  108. *
  109. * @param[out] modes A vector that will be populated with the sensor modes.
  110. *
  111. * @returns success/status of the call.
  112. */
  113. virtual Status getBasicSensorModes(std::vector<SensorMode*>* modes) const = 0;
  114. /**
  115. * Returns all the available sensor modes including the ones that have extensions.
  116. * The extended modes support some form of Wide Dynamic Range (WDR) technology.
  117. *
  118. * All the returned modes will support the basic sensor mode interface.
  119. * @see ISensorMode
  120. *
  121. * @param[out] modes A vector that will be populated with the sensor modes.
  122. *
  123. * @returns success/status of the call.
  124. */
  125. virtual Status getAllSensorModes(std::vector<SensorMode*>* modes) const = 0;
  126. /**
  127. * Returns all the recommended aperture positions.
  128. *
  129. * @param[out] positions a vector that will be populated with the aperture positions.
  130. *
  131. * @returns success/status of the call.
  132. */
  133. virtual Status getAperturePositions(std::vector<int32_t>* positions) const = 0;
  134. /**
  135. * Returns all the available aperture f-numbers.
  136. *
  137. * @param[out] fnumbers A pointer to a vector to be populated with the
  138. * aperture f-numbers.
  139. *
  140. * @returns success/status of the call.
  141. */
  142. virtual Status getAvailableApertureFNumbers(std::vector<float>* fnumbers) const = 0;
  143. /**
  144. * Returns the valid range of focuser positions.
  145. * The units are focuser steps.
  146. */
  147. virtual Range<int32_t> getFocusPositionRange() const = 0;
  148. /**
  149. * Returns the valid range of aperture positions.
  150. * The units are aperture positions.
  151. */
  152. virtual Range<int32_t> getAperturePositionRange() const = 0;
  153. /**
  154. * Returns the valid range of aperture step positions per second.
  155. * The units are aperture motor steps/second.
  156. */
  157. virtual Range<float> getApertureMotorSpeedRange() const = 0;
  158. /**
  159. * Returns the supported range of ISP digital gain.
  160. */
  161. virtual Range<float> getIspDigitalGainRange() const = 0;
  162. /**
  163. * Returns the supported range of Exposure Compensation.
  164. */
  165. virtual Range<float> getExposureCompensationRange() const = 0;
  166. /**
  167. * Returns the model name of the device.
  168. */
  169. virtual const std::string& getModelName() const = 0;
  170. /**
  171. * Returns the module string for the device.
  172. * Contains the device's name, position, and partial model number.
  173. * This string is unique for each device on the system.
  174. */
  175. virtual const std::string& getModuleString() const = 0;
  176. protected:
  177. ~ICameraProperties() {}
  178. };
  179. /**
  180. * Child object representing a CameraDevice's sensor mode, returned by
  181. * ICameraProperties::getAllSensorModes
  182. *
  183. * @defgroup ArgusSensorMode SensorMode
  184. * @ingroup ArgusCameraDevice
  185. */
  186. class SensorMode : public InterfaceProvider
  187. {
  188. protected:
  189. ~SensorMode() {}
  190. };
  191. /**
  192. * @class ISensorMode
  193. *
  194. * Interface to the core properties of a SensorMode.
  195. *
  196. * @ingroup ArgusSensorMode
  197. */
  198. DEFINE_UUID(InterfaceID, IID_SENSOR_MODE, e69015e0,db2a,11e5,a837,18,00,20,0c,9a,66);
  199. class ISensorMode : public Interface
  200. {
  201. public:
  202. static const InterfaceID& id() { return IID_SENSOR_MODE; }
  203. /**
  204. * Returns the image resolution, in pixels.
  205. */
  206. virtual Size2D<uint32_t> getResolution() const = 0;
  207. /**
  208. * Returns the supported exposure time range (in nanoseconds).
  209. */
  210. virtual Range<uint64_t> getExposureTimeRange() const = 0;
  211. /**
  212. * Returns the hdr ratio range, it is the ratio of long exposure vs short exposure.
  213. * When min and/or max is greater than 1, long exposure range is given by getExposureTimeRange()
  214. * and short exposure range is computed as following:
  215. * short exposure min = getExposureTimeRange().min() / getHdrRatioRange().max()
  216. * short exposure max = getExposureTimeRange().max() / getHdrRatioRange().min().
  217. */
  218. virtual Range<float> getHdrRatioRange() const = 0;
  219. /**
  220. * Returns the supported frame duration range (in nanoseconds).
  221. */
  222. virtual Range<uint64_t> getFrameDurationRange() const = 0;
  223. /**
  224. * Returns the supported analog gain range.
  225. */
  226. virtual Range<float> getAnalogGainRange() const = 0;
  227. /**
  228. * Returns the bit depth of the image captured by the image sensor in the
  229. * current mode. For example, a wide dynamic range image sensor capturing
  230. * 16 bits per pixel would have an input bit depth of 16.
  231. */
  232. virtual uint32_t getInputBitDepth() const = 0;
  233. /**
  234. * Returns the bit depth of the image returned from the image sensor in the
  235. * current mode. For example, a wide dynamic range image sensor capturing
  236. * 16 bits per pixel might be connected through a Camera Serial Interface
  237. * (CSI-3) which is limited to 12 bits per pixel. The sensor would have to
  238. * compress the image internally and would have an output bit depth not
  239. * exceeding 12.
  240. */
  241. virtual uint32_t getOutputBitDepth() const = 0;
  242. /**
  243. * Describes the type of the sensor (Bayer, Yuv, etc.) and key modes of
  244. * operation which are enabled in the sensor mode (Wide-dynamic range,
  245. * Piecewise Linear Compressed output, etc.)
  246. */
  247. virtual SensorModeType getSensorModeType() const = 0;
  248. /**
  249. * Describes the bayer phase of Bayer mode
  250. */
  251. virtual BayerPhase getBayerPhase() const = 0;
  252. /**
  253. * Checks if the buffer provided is supported by the camera device.
  254. */
  255. virtual bool isBufferFormatSupported(Buffer* buffer) const = 0;
  256. protected:
  257. ~ISensorMode() {}
  258. };
  259. } // namespace Argus
  260. #endif // _ARGUS_CAMERA_DEVICE_H