Libargus API
Libargus Camera API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Settings.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2019, 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 /**
30  * @file
31  * <b>Libargus API: Settings API</b>
32  *
33  * @b Description: This file defines the settings that control the sensor module.
34  */
35 
36 #ifndef _ARGUS_SETTINGS_H
37 #define _ARGUS_SETTINGS_H
38 
39 namespace Argus
40 {
41 
42 /**
43  * @class ISourceSettings
44  *
45  * Interface to the source settings (provided by IRequest::getSourceSettings()).
46  *
47  * @ingroup ArgusSourceSettings
48  */
49 DEFINE_UUID(InterfaceID, IID_SOURCE_SETTINGS, eb7ae38c,3c62,4161,a92a,a6,4f,ba,c6,38,83);
50 class ISourceSettings : public Interface
51 {
52 public:
53  static const InterfaceID& id() { return IID_SOURCE_SETTINGS; }
54 
55  /**
56  * Sets the exposure time range of the source, in nanoseconds.
57  * If the exposure range is outside of the available range, the capture's exposure time
58  * will be as close as possible to the exposure range specified.
59  * @param[in] exposureTimeRange Exposure time range, in nanoseconds.
60  * @see ISensorMode::getExposureTimeRange()
61  * @todo Document implications of quantization.
62  *
63  * @returns success/status of the call.
64  */
65  virtual Status setExposureTimeRange(const Range<uint64_t>& exposureTimeRange) = 0;
66 
67  /**
68  * Returns the exposure time range of the source, in nanoseconds.
69  */
70  virtual Range<uint64_t> getExposureTimeRange() const = 0;
71 
72  /**
73  * Sets the focus position, in focuser units. If the position
74  * is set outside of the focuser limits, the position will be clamped.
75  * @param[in] position The new focus position, in focuser units.
76  * @see ICameraProperties::getFocusPositionRange()
77  *
78  * @returns success/status of the call.
79  */
80  virtual Status setFocusPosition(int32_t position) = 0;
81 
82  /**
83  * Returns the focus position, in focuser units.
84  */
85  virtual int32_t getFocusPosition() const = 0;
86 
87  /**
88  * Sets the aperture motor step position. If the step
89  * is set outside of the step limits, the step will be clamped.
90  * @param[in] step The new step position.
91  * @see ICameraProperties::getApertureMotorStepRange()
92  *
93  * @returns success/status of the call.
94  */
95  virtual Status setApertureMotorStep(int32_t step) = 0;
96 
97  /**
98  * Returns the aperture motor step position.
99  */
100  virtual int32_t getApertureMotorStep() const = 0;
101 
102  /**
103  * Sets the aperture motor speed in motor steps/second. If the speed
104  * is set outside of the speed limits, the speed will be clamped.
105  * @param[in] speed The new speed.
106  * @see ICameraProperties::getApertureMotorSpeedRange()
107  *
108  * @returns success/status of the call.
109  */
110  virtual Status setApertureMotorSpeed(float speed) = 0;
111 
112  /**
113  * Returns the aperture motor speed in motor steps/second.
114  */
115  virtual float getApertureMotorSpeed() const = 0;
116 
117  /**
118  * Sets the frame duration range, in nanoseconds.
119  * If frame range is out of bounds of the current sensor mode,
120  * the capture's frame duration will be as close as possible to the range specified.
121  * @param[in] frameDurationRange Frame duration range, in nanoseconds
122  * @see ISensorMode::getFrameDurationRange()
123  *
124  * @returns success/status of the call.
125  */
126  virtual Status setFrameDurationRange(const Range<uint64_t>& frameDurationRange) = 0;
127 
128  /**
129  * Returns the frame duration range, in nanoseconds.
130  */
131  virtual Range<uint64_t> getFrameDurationRange() const = 0;
132 
133  /**
134  * Sets the gain range for the sensor.
135  * The range has to be within the max and min reported in the CameraProperties
136  * Otherwise the range will be clipped.
137  * @param[in] gainRange scalar gain range
138  * @see ISensorMode::getAnalogGainRange()
139  *
140  * @returns success/status of the call.
141  */
142  virtual Status setGainRange(const Range<float>& gainRange) = 0;
143 
144  /**
145  * Returns the gain range.
146  */
147  virtual Range<float> getGainRange() const = 0;
148 
149  /**
150  * Sets the sensor mode.
151  * Note that changing sensor mode from one capture to the next may result in
152  * multiple sensor frames being dropped between the two captures.
153  * @param[in] mode Desired sensor mode for the capture.
154  * @see ICameraProperties::getAllSensorModes()
155  *
156  * @returns success/status of the call.
157  */
158  virtual Status setSensorMode(SensorMode* mode) = 0;
159 
160  /**
161  * Returns the sensor mode.
162  */
163  virtual SensorMode* getSensorMode() const = 0;
164 
165  /**
166  * Sets the user-specified optical black levels.
167  * These values will be ignored unless <tt>getOpticalBlackEnable() == true</tt>
168  * Values are floating point in the range [0,1) normalized based on sensor bit depth.
169  * @param[in] opticalBlackLevels opticalBlack levels in range [0,1) per bayer phase
170  *
171  * @returns success/status of the call.
172  */
173  virtual Status setOpticalBlack(const BayerTuple<float>& opticalBlackLevels) = 0;
174 
175  /**
176  * Returns user-specified opticalBlack level per bayer phase.
177  *
178  * @returns opticalBlackLevels
179  */
180  virtual BayerTuple<float> getOpticalBlack() const = 0;
181 
182  /**
183  * Sets whether or not user-provided optical black levels are used.
184  * @param[in] enable If @c true, Argus will use the user-specified optical black levels.
185  * @see setOpticalBlack()
186  * If @c false, the Argus implementation will choose the optical black values.
187  *
188  * @returns success/status of the call.
189  */
190  virtual Status setOpticalBlackEnable(bool enable) = 0;
191 
192  /**
193  * Returns whether user-specified optical black levels are enabled.
194  * If false, the Argus implementation will choose the optical black values.
195  * @see setOpticalBlackEnable()
196  *
197  * @returns enable
198  */
199  virtual bool getOpticalBlackEnable() const = 0;
200 
201 
202 protected:
204 };
205 
206 /**
207  * @class IAutoControlSettings
208  *
209  * Interface to the auto control settings (provided by IRequest::getAutoControlSettings()).
210  *
211  * @ingroup ArgusAutoControlSettings
212  */
213 DEFINE_UUID(InterfaceID, IID_AUTO_CONTROL_SETTINGS, 1f2ad1c6,cb13,440b,bc95,3f,fd,0d,19,91,db);
215 {
216 public:
217  static const InterfaceID& id() { return IID_AUTO_CONTROL_SETTINGS; }
218 
219  /**
220  * Sets the AE antibanding mode.
221  * @param[in] mode The requested antibanding mode.
222  *
223  * @returns success/status of the call.
224  */
225  virtual Status setAeAntibandingMode(const AeAntibandingMode& mode) = 0;
226 
227  /**
228  * Returns the AE antibanding mode.
229  */
230  virtual AeAntibandingMode getAeAntibandingMode() const = 0;
231 
232  /**
233  * Sets the AE lock. When locked, AE will maintain constant exposure.
234  * @param[in] lock If @c true, locks AE at its current exposure.
235  *
236  * @returns success/status of the call.
237  */
238  virtual Status setAeLock(bool lock) = 0;
239 
240  /**
241  * Returns the AE lock.
242  */
243  virtual bool getAeLock() const = 0;
244 
245  /**
246  * Sets the AE regions of interest.
247  * If no regions are specified, the entire image is the region of interest.
248  * @param[in] regions The AE regions of interest.
249  * The maximum number of regions is returned by @c ICameraProperties::getMaxAeRegions().
250  *
251  * @returns success/status of the call.
252  */
253  virtual Status setAeRegions(const std::vector<AcRegion>& regions) = 0;
254 
255  /**
256  * Returns the AE regions of interest.
257  * @param[out] regions A vector that will be populated with the AE regions of interest.
258  *
259  * @returns success/status of the call.
260  */
261  virtual Status getAeRegions(std::vector<AcRegion>* regions) const = 0;
262 
263  /**
264  * Sets the AWB lock.
265  * @param[in] lock If @c true, locks AWB at its current state.
266  *
267  * @returns success/status of the call.
268  */
269  virtual Status setAwbLock(bool lock) = 0;
270 
271  /**
272  * Returns the AWB lock.
273  */
274  virtual bool getAwbLock() const = 0;
275 
276  /**
277  * Sets the AWB mode.
278  * @param[in] mode The new AWB mode.
279  *
280  * @returns success/status of the call.
281  */
282  virtual Status setAwbMode(const AwbMode& mode) = 0;
283 
284  /**
285  * Returns the AWB mode.
286  */
287  virtual AwbMode getAwbMode() const = 0;
288 
289  /**
290  * Sets the AWB regions of interest.
291  * If no regions are specified, the entire image is the region of interest.
292  * @param[in] regions The AWB regions of interest.
293  * The maximum number of regions is returned by @c ICameraProperties::getMaxAwbRegions().
294  *
295  * @returns success/status of the call.
296  */
297  virtual Status setAwbRegions(const std::vector<AcRegion>& regions) = 0;
298 
299  /**
300  * Returns the AWB regions of interest.
301  * @param[out] regions A vector that will be populated with the AWB regions of interest.
302  *
303  * @returns success/status of the call.
304  */
305  virtual Status getAwbRegions(std::vector<AcRegion>* regions) const = 0;
306 
307  /**
308  * Sets the Manual White Balance gains.
309  * @param[in] gains The Manual White Balance Gains
310  *
311  * @returns success/status of the call.
312  */
313  virtual Status setWbGains(const BayerTuple<float>& gains) = 0;
314 
315  /**
316  * Returns the Manual White Balance gains.
317  *
318  * @returns Manual White Balance Gains structure
319  */
320  virtual BayerTuple<float> getWbGains() const = 0;
321 
322  /**
323  * Returns the size of the color correction matrix.
324  */
326 
327  /**
328  * Sets the user-specified color correction matrix.
329  * This matrix will be ignored unless <tt>getColorCorrectionMatrixEnable() == true</tt>.
330  * The active color correction matrix used for image processing may be internally modified
331  * to account for the active color saturation value (either user-specified or automatically
332  * generated, after biasing, @see setColorSaturation and @see setColorSaturationBias).
333  * @param[in] matrix A color correction matrix that maps sensor RGB to linear sRGB. This matrix
334  * is given in row-major order and must have the size w*h, where w and h are
335  * the width and height of the Size returned by getColorCorrectionMatrixSize()
336  *
337  * @returns success/status of the call.
338  */
339  virtual Status setColorCorrectionMatrix(const std::vector<float>& matrix) = 0;
340 
341  /**
342  * Returns the user-specified color correction matrix.
343  * @param[out] matrix A matrix that will be populated with the CCM.
344  *
345  * @returns success/status of the call.
346  */
347  virtual Status getColorCorrectionMatrix(std::vector<float>* matrix) const = 0;
348 
349  /**
350  * Enables the user-specified color correction matrix.
351  * @param[in] enable If @c true, libargus uses the user-specified matrix.
352  * @see setColorCorrectionMatrix()
353  *
354  * @returns success/status of the call.
355  */
356  virtual Status setColorCorrectionMatrixEnable(bool enable) = 0;
357 
358  /**
359  * Returns the enable for the user-specified color correction matrix.
360  */
361  virtual bool getColorCorrectionMatrixEnable() const = 0;
362 
363  /**
364  * Sets the user-specified absolute color saturation. This must be enabled via
365  * @see setColorSaturationEnable, otherwise saturation will be determined automatically.
366  * This saturation value may be used to modify the color correction matrix used
367  * for processing (@see setColorCorrectionMatrix), and these changes will be reflected
368  * in the color correction matrix output to the capture metadata.
369  * @param[in] saturation The absolute color saturation. Acceptable values are in
370  * [0.0, 2.0], and the default value is 1.0.
371 
372  * @returns success/status of the call.
373  */
374  virtual Status setColorSaturation(float saturation) = 0;
375 
376  /**
377  * Returns the user-specified absolute color saturation (@see setColorSaturation).
378  */
379  virtual float getColorSaturation() const = 0;
380 
381  /**
382  * Enables the user-specified absolute color saturation.
383  * @param[in] enable If @c true, libargus uses the user-specified color saturation.
384  * @see setColorSaturation()
385  *
386  * @returns success/status of the call.
387  */
388  virtual Status setColorSaturationEnable(bool enable) = 0;
389 
390  /**
391  * Returns the enable for the user-specified color saturation.
392  */
393  virtual bool getColorSaturationEnable() const = 0;
394 
395  /**
396  * Sets the color saturation bias. This bias is used to multiply the active saturation
397  * value, either the user-specified or the automatically generated value depending on the state
398  * of @see getColorSaturationEnable, and produces the final saturation value to use for
399  * capture processing. This is used primarily to tweak automatically generated saturation
400  * values when the application prefers more or less saturation than what the implementation
401  * or hardware generates by default. The final saturation value (after biasing) may affect the
402  * color correction matrix used for processing (@see setColorCorrectionMatrix).
403  * @param[in] bias The color saturation bias. Acceptable values are in [0.0, 2.0], where
404  * 1.0 does not modify the saturation (default), 0.0 is fully desaturated
405  * (greyscale), and 2.0 is highly saturated.
406  *
407  * @returns success/status of the call.
408  */
409  virtual Status setColorSaturationBias(float bias) = 0;
410 
411  /**
412  * Returns the color saturation bias.
413  */
414  virtual float getColorSaturationBias() const = 0;
415 
416  /**
417  * Sets the exposure compensation.
418  * Exposure compensation is applied after AE is solved.
419  * @param[in] ev The exposure adjustment step in stops.
420  *
421  * @returns success/status of the call.
422  */
423  virtual Status setExposureCompensation(float ev) = 0;
424 
425  /**
426  * Returns the exposure compensation.
427  */
428  virtual float getExposureCompensation() const = 0;
429 
430  /**
431  * Returns the number of elements required for the tone map curve.
432  * @param[in] channel The color channel the curve size corresponds to.
433  */
434  virtual uint32_t getToneMapCurveSize(RGBChannel channel) const = 0;
435 
436  /**
437  * Sets the user-specified tone map curve for a channel on the stream.
438  * The user-specified tone map will be ignored unless <tt>getToneMapCurveEnable() == true</tt>.
439  * @param[in] channel The color the curve corresponds to.
440  * @param[in] curve A float vector that describes the LUT.
441  * The number of elements must match the number of elements
442  * returned from getToneMapCurve() of the same channel.
443  *
444  * @returns success/status of the call.
445  */
446  virtual Status setToneMapCurve(RGBChannel channel, const std::vector<float>& curve) = 0;
447 
448  /**
449  * Returns the user-specified tone map curve for a channel on the stream.
450  * @param[in] channel The color the curve corresponds to.
451  * @param[out] curve A vector that will be populated by the tone map curve for the specified
452  * color channel.
453  *
454  * @returns success/status of the call.
455  */
456  virtual Status getToneMapCurve(RGBChannel channel, std::vector<float>* curve) const = 0;
457 
458  /**
459  * Enables the user-specified tone map.
460  * @param[in] enable If @c true, libargus uses the user-specified tone map.
461  *
462  * @returns success/status of the call.
463  */
464  virtual Status setToneMapCurveEnable(bool enable) = 0;
465 
466  /**
467  * Returns the enable for the user-specified tone map.
468  */
469  virtual bool getToneMapCurveEnable() const = 0;
470 
471  /**
472  * Sets the user-specified Isp Digital gain range.
473  * @param[in] gain The user-specified Isp Digital gain.
474  *
475  * @returns success/status of the call.
476  */
477  virtual Status setIspDigitalGainRange(const Range<float>& gain) = 0;
478 
479  /**
480  * Returns the user-specified Isp Digital gain range.
481  *
482  * @returns Isp Digital gain
483  */
484  virtual Range<float> getIspDigitalGainRange() const = 0;
485 
486 protected:
488 };
489 
490 /**
491  * @class IStreamSettings
492  *
493  * Interface to per-stream settings (provided by IRequest::getStreamSettings()).
494  *
495  * @ingroup ArgusStreamSettings
496  */
497 DEFINE_UUID(InterfaceID, IID_STREAM_SETTINGS, c477aeaf,9cc8,4467,a834,c7,07,d7,b6,9f,a4);
499 {
500 public:
501  static const InterfaceID& id() { return IID_STREAM_SETTINGS; }
502 
503  /**
504  * Sets the clip rectangle for the stream.
505  * A clip rectangle is a normalized rectangle
506  * with valid coordinates contained in the [0.0,1.0] range.
507  * @param[in] clipRect The clip rectangle.
508  *
509  * @returns success/status of the call.
510  */
511  virtual Status setSourceClipRect(const Rectangle<float>& clipRect) = 0;
512 
513  /**
514  * Returns the clip rectangle for the stream.
515  */
516  virtual Rectangle<float> getSourceClipRect() const = 0;
517 
518  /**
519  * Sets whether or not post-processing is enabled for this stream.
520  * Post-processing features are controlled on a per-Request basis and all streams share the
521  * same post-processing control values, but this enable allows certain streams to be excluded
522  * from all post-processing. The current controls defined to be a part of "post-processing"
523  * includes (but may not be limited to):
524  * - Denoise
525  * Default value is true.
526  */
527  virtual void setPostProcessingEnable(bool enable) = 0;
528 
529  /**
530  * Returns the post-processing enable for the stream.
531  */
532  virtual bool getPostProcessingEnable() const = 0;
533 
534 protected:
536 };
537 
538 /**
539  * @class IDenoiseSettings
540  *
541  * Interface to denoise settings.
542  *
543  * @ingroup ArgusRequest
544  */
545 DEFINE_UUID(InterfaceID, IID_DENOISE_SETTINGS, 7A461D20,6AE1,11E6,BDF4,08,00,20,0C,9A,66);
547 {
548 public:
549  static const InterfaceID& id() { return IID_DENOISE_SETTINGS; }
550 
551  /**
552  * Sets the denoise (noise reduction) mode for the request.
553  * @param[in] mode The denoise mode:
554  * OFF: Denoise algorithms are disabled.
555  * FAST: Noise reduction will be enabled, but it will not slow down
556  * the capture rate.
557  * HIGH_QUALITY: Maximum noise reduction will be enabled to achieve
558  * the highest quality, but may slow down the capture rate.
559  * @returns success/status of the call.
560  */
561  virtual Status setDenoiseMode(const DenoiseMode& mode) = 0;
562 
563  /**
564  * Returns the denoise mode for the request.
565  */
566  virtual DenoiseMode getDenoiseMode() const = 0;
567 
568  /**
569  * Sets the strength for the denoise operation.
570  * @param[in] strength The denoise strength. This must be within the range [0.0, 1.0], where
571  * 0.0 is the least and 1.0 is the most amount of noise reduction that can be
572  * applied. This denoise strength is relative to the current noise reduction mode;
573  * using a FAST denoise mode with a full strength of 1.0 may not perform as well
574  * as using a HIGH_QUALITY mode with a lower relative strength.
575  * @returns success/status of the call.
576  */
577  virtual Status setDenoiseStrength(float strength) = 0;
578 
579  /**
580  * Returns the denoise strength.
581  */
582  virtual float getDenoiseStrength() const = 0;
583 
584 protected:
586 };
587 
588 /**
589  * @class IEdgeEnhanceSettings
590  *
591  * Interface to edge enhancement settings.
592  *
593  * @ingroup ArgusRequest
594  */
595 DEFINE_UUID(InterfaceID, IID_EDGE_ENHANCE_SETTINGS, 7A461D21,6AE1,11E6,BDF4,08,00,20,0C,9A,66);
597 {
598 public:
599  static const InterfaceID& id() { return IID_EDGE_ENHANCE_SETTINGS; }
600 
601  /**
602  * Sets the edge enhancement mode for the request.
603  * @param[in] mode The edge enhancement mode:
604  * OFF: Edge enhancement algorithms are disabled.
605  * FAST: Edge enhancement will be enabled, but it will not slow down
606  * the capture rate.
607  * HIGH_QUALITY: Maximum edge enhancement will be enabled to achieve
608  * the highest quality, but may slow down the capture rate.
609  * @returns success/status of the call.
610  */
611  virtual Status setEdgeEnhanceMode(const EdgeEnhanceMode& mode) = 0;
612 
613  /**
614  * Returns the edge enhancement mode for the request.
615  */
616  virtual EdgeEnhanceMode getEdgeEnhanceMode() const = 0;
617 
618  /**
619  * Sets the strength for the edge enhancement operation.
620  * @param[in] strength The edge enhancement strength. This must be within the range [0.0, 1.0],
621  * where 0.0 is the least and 1.0 is the most amount of edge enhancement that can be
622  * applied. This strength is relative to the current edge enhancement mode; using
623  * a FAST edge enhancement mode with a full strength of 1.0 may not perform as well
624  * as using a HIGH_QUALITY mode with a lower relative strength.
625  * @returns success/status of the call.
626  */
627  virtual Status setEdgeEnhanceStrength(float strength) = 0;
628 
629  /**
630  * Returns the edge enhancement strength.
631  */
632  virtual float getEdgeEnhanceStrength() const = 0;
633 
634 protected:
636 };
637 
638 } // namespace Argus
639 
640 #endif // _ARGUS_SETTINGS_H