Libargus API Libargus Camera API

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
BayerSharpnessMap.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016-2017, 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 Extension: Bayer Sharpness Map API</b>
32 *
33 * @b Description: This file defines the BayerSharpnessMap extension.
34 */
35
36 #ifndef _ARGUS_EXT_BAYER_SHARPNESS_MAP_H
37 #define _ARGUS_EXT_BAYER_SHARPNESS_MAP_H
38
39 namespace Argus
40 {
41
42 /**
43 * Adds internally-generated sharpness metrics to CaptureMetadata results. These are used
44 * in order to help determine the correct position of the lens to achieve the best focus.
45 * It introduces two new interfaces:
46 * - IBayerSharpnessMapSettings; used to enable sharness map generation in a capture Request.
47 * - IBayerSharpnessMapMetadata; exposes the sharpness map metrics from the CaptureMetadata.
48 *
49 * @defgroup ArgusExtBayerSharpnessMap Ext::BayerSharpnessMap
50 * @ingroup ArgusExtensions
51 */
52 DEFINE_UUID(ExtensionName, EXT_BAYER_SHARPNESS_MAP, 7d5e0470,4ea6,11e6,bdf4,08,00,20,0c,9a,66);
53
54 namespace Ext
55 {
56
57 /**
58 * @class IBayerSharpnessMapSettings
59 *
60 * Interface to Bayer sharpness map settings.
61 *
62 * @ingroup ArgusRequest ArgusExtBayerSharpnessMap
63 */
64 DEFINE_UUID(InterfaceID, IID_BAYER_SHARPNESS_MAP_SETTINGS, 7d5e0471,4ea6,11e6,bdf4,08,00,20,0c,9a,66);
65 class IBayerSharpnessMapSettings : public Interface
66 {
67 public:
68 static const InterfaceID& id() { return IID_BAYER_SHARPNESS_MAP_SETTINGS; }
69
70 /**
71 * Enables or disables Bayer sharpness map generation. When enabled, CaptureMetadata
72 * returned by completed captures expose the IBayerSharpnessMap interface.
73 * @param[in] enable If True, Bayer sharpness map generation is enabled.
74 */
75 virtual void setBayerSharpnessMapEnable(bool enable) = 0;
76
77 /**
78 * Returns True if sharpness map generation is enabled.
79 */
80 virtual bool getBayerSharpnessMapEnable() const = 0;
81
82 protected:
83 ~IBayerSharpnessMapSettings() {}
84 };
85
86 /**
87 * @class IBayerSharpnessMap
88 *
89 * Interface to Bayer sharpness map metadata.
90 *
91 * The Bayer sharpness map exposes image sharpness metrics that can be used in order
92 * to help determine the correct position of the lens to achieve the best focus.
93 * Each metric is a normalized floating-point value representing the estimated sharpness
94 * for a particular color channel and pixel region, called bins, where 0.0 and 1.0 map to
95 * the minimum and maximum possible sharpness values, respectively. Sharpness values
96 * generally correlate with image focus in that a low sharpness implies a poorly focused
97 * (blurry) region while a high sharpness implies a well focused (sharp) region.
98 *
99 * The size and layout of the bins used to calculate the sharpness metrics are determined
100 * by the libargus implementation, and are illustrated in the following diagram. The bin size
101 * and interval are constant across the image, and are positioned such that the generated
102 * metrics cover the majority of the full image. All dimensions are given in pixels.
103 *
104 * @code
105 * start.x interval.width
106 * _______ _________________
107 * | | | |
108 * _ ________________________________________________________
109 * | | |
110 * start.y | | |
111 * |_ | _____ _____ _____ | _
112 * | | | | | | | | |
113 * | | 0,0 | | 1,0 | | 2,0 | | |
114 * | |_____| |_____| |_____| | |
115 * | | | interval.height
116 * | | |
117 * | | |
118 * | _____ _____ _____ | _|
119 * | | | | | | | |
120 * | | 0,1 | | 1,1 | | 2,1 | |
121 * | |_____| |_____| |_____| |
122 * | |
123 * | |
124 * | |
125 * | _____ _____ _____ | _
126 * | | | | | | | | |
127 * | | 0,2 | | 1,2 | | 2,2 | | | size.height
128 * | |_____| |_____| |_____| | _|
129 * | |
130 * | |
131 * |________________________________________________________|
132 *
133 * |_____|
134 *
135 * size.width
136 * @endcode
137 *
138 * @ingroup ArgusCaptureMetadata ArgusExtBayerSharpnessMap
139 */
140 DEFINE_UUID(InterfaceID, IID_BAYER_SHARPNESS_MAP, 7d5e0472,4ea6,11e6,bdf4,08,00,20,0c,9a,66);
141 class IBayerSharpnessMap : public Interface
142 {
143 public:
144 static const InterfaceID& id() { return IID_BAYER_SHARPNESS_MAP; }
145
146 /**
147 * Returns the starting location of the first bin, in pixels, where the
148 * location is relative to the top-left corner of the image.
149 */
150 virtual Point2D<uint32_t> getBinStart() const = 0;
151
152 /**
153 * Returns the size of each bin, in pixels.
154 */
155 virtual Size2D<uint32_t> getBinSize() const = 0;
156
157 /**
158 * Returns the number of bins in both the horizontal (width) and vertical (height) directions.
159 */
160 virtual Size2D<uint32_t> getBinCount() const = 0;
161
162 /**
163 * Returns the bin intervals for both the x and y axis. These intervals are defined as the
164 * number of pixels between the first pixel of a bin and that of the immediate next bin.
165 */
166 virtual Size2D<uint32_t> getBinInterval() const = 0;
167
168 /**
169 * Returns the sharpness values for all bins and color channels. These values are normalized
170 * such that 0.0 and 1.0 map to the minimum and maximum possible sharpness values, respectively.
171 *
172 * @param[out] values The output array to store the sharpness values for all bins. This
173 * 2-dimensional array will be sized as returned by @see getBinCount(), where
174 * each array element is a floating point BayerTuple containing the R, G_EVEN,
175 * G_ODD, and B sharpness values for that bin.
176 */
177 virtual Status getSharpnessValues(Array2D< BayerTuple<float> >* values) const = 0;
178
179 protected:
180 ~IBayerSharpnessMap() {}
181 };
182
183 } // namespace Ext
184
185 } // namespace Argus
186
187 #endif // _ARGUS_EXT_BAYER_SHARPNESS_MAP_H