FireSync API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kSpot.h
Go to the documentation of this file.
1 
8 #ifndef K_FIRESYNC_SPOT_H
9 #define K_FIRESYNC_SPOT_H
10 
11 #include <kFireSync/kFsDef.h>
12 #include <kFireSync/kNodeDef.h>
13 #include <kApi/Data/kArrayList.h>
14 #include <kApi/Data/kArray1.h>
15 #include <kApi/Data/kImage.h>
16 
17 kBeginHeader()
18 
19 #define kSPOT_CENTRE_SHIFT (8) // centre shift
20 #define kSPOT_CENTRE_SCALE (1 << kSPOT_CENTRE_SHIFT) // centre scale
21 
22 typedef struct
23 {
24  k32u centre; /* scaled centre of the spot (along slice) */
25  k16u slice; /* slice index */
26  k16u strength; /* spot strength metric (e.g. sum, peak) */
27  k16u width; /* spot width */
28 } kSpot;
29 
30 typedef struct
31 {
32  k32u centre[2]; /* scaled centre of the spot in each dimension */
33  k32u strength; /* spot strength metric (e.g. sum, peak) */
34 } kSpot2;
35 
36 typedef struct
37 {
38  k16u sum; /* sum of pixel intensities along slice */
39  k16u wsum; /* weighted sum of pixel intensities along slice */
40 } kFpgaCSum;
41 
42 typedef struct kFpgaCSum3
43 {
44  k32u csum3;
45 } kFpgaCSum3;
46 
47 #define kFPGA_CSUM3_OVERFLOW(CSUM3) kxFPGA_CSUM3_OVERFLOW(CSUM3)
48 #define kFPGA_CSUM3_SUM(CSUM3) kxFPGA_CSUM3_SUM(CSUM3)
49 #define kFPGA_CSUM3_WSUM(CSUM3) kxFPGA_CSUM3_WSUM(CSUM3)
50 
61 typedef struct kCSum4
62 {
64 } kCSum4;
65 
73 #define kCSum4_MaxSum_() kxCSum4_MaxSum_()
74 
80 #define kCSum4_MaxWSum_() kxCSum4_MaxWSum_()
81 
89 #define kCSum4_Init_(CSUM, SUM, WSUM) kxCSum4_Init_(CSUM, SUM, WSUM)
90 
96 #define kCSum4_InitOverflow_(CSUM) kxCSum4_InitOverflow_(CSUM)
97 
106 #define kCSum4_IsOverflow_(CSUM) kxCSum4_IsOverflow_(CSUM)
107 
114 #define kCSum4_SetSum_(CSUM, SUM) kxCSum4_SetSum_(CSUM, SUM)
115 
122 #define kCSum4_Sum_(CSUM) kxCSum4_Sum_(CSUM)
123 
130 #define kCSum4_SetWSum_(CSUM, WSUM) kxCSum4_SetSum_(CSUM, WSUM)
131 
138 #define kCSum4_WSum_(CSUM) kxCSum4_WSum_(CSUM)
139 
141 // input expects an array list of kTypeOf(kFpgaSpot), kTYPE_FPGA_CG or kTYPE_FPGA_CG2
142 // output expects an initialized array list of kSpot
143 kFsFx(kStatus) kSpot_Unpack(kArrayList input, kArrayList output);
144 
145 // spots expects an initialized array list of kSpot
146 kFsFx(kStatus) kSpot_ARCG(kImage img, k32u minSpotWidth, k32u maxSpotWidth, k32u threshold, kArrayList spots);
147 
148 // FPGA ACCG implementation
149 kFsFx(kStatus) kFpgaSpot_ACCG(kImage image, k32u minSpotWidth, k32u maxSpotWidth, k32u threshold, kArrayList spots);
150 
151 // spots expects an initialized array list of kSpot
152 kFsFx(kStatus) kSpot_ACCG(kImage img, k32u minSpotWidth, k32u maxSpotWidth, k32u threshold, kArrayList spots);
153 
154 kFsFx(kStatus) kSpot_CSUM(kImage image, k32u threshold, kArrayList *sums);
155 
156 // spots expects an initialized array list of kFpgaCSum3
157 kFsFx(kStatus) kSpot_CSum3(kImage image, k32u threshold, kArrayList csum3);
158 
159 // spots expects an initialized array list of k64u
160 kFsFx(kStatus) kSpot_Binarize(kImage image, k32u threshold, kArrayList binarize);
161 
162 // kSpot_SobelArcg
163 //
164 // Description:
165 // Performs Sobel-filtered ARCG spot detection. This is the old implementation. It is currently being used as this version matches the FPGA version.
166 // Inputs:
167 // image - input kImage data to be processed, expects pixel type kTypeOf(k8s)
168 // averageWindow - Sobel filter height in pixels
169 // edgeWindow - Sobel filter width in pixels, expects odd number (counts center pixel)
170 // threshold - Rising and falling edge threshold
171 // widthThreshold - Used for width calculation, only pixels with an intensity greater than baseIntensity + widthThreshold are accepted.
172 // minWidth - minimum spot width
173 // maxWidth - maximum spot width
174 // minSum - minimum spot sum
175 // Outputs:
176 // spots - returns detected spot objects, expects an initialized array of type kTYPE_SPOT, kTypeOf(kFpgaSpot), or kTypeOf(kFpgaWideSpot)
177 // with capacity equal to maximum expected number of spots
178 // bounds - returns x coordinates of rising and falling edge spot boundaries, expects an initialized array of type kTYPE_POINT_32S or kNIL
179 // edgeImage - returns the gradient image, expects an initialized image of pixel type kTypeOf(k8s) of size equal to the input image or kNIL
180 
181 kFsFx(kStatus) kSpot_SobelArcg(kImage image, k32u averageWindow, k32u edgeWindow, k32u threshold, k32u widthThreshold, k32u minWidth,
182  k32u maxWidth, k32u minSum, kArrayList spots, kArrayList bounds, kImage edgeImage);
183 
184 // kSpot_SobelArcg
185 //
186 // Description:
187 // Performs Sobel-filtered ARCG spot detection. This is the new implementation of kSpot_SobelArcg.
188 // Inputs:
189 // image - input kImage data to be processed, expects pixel type kTypeOf(k8s)
190 // averageWindow - Sobel filter height in pixels
191 // edgeWindow - Sobel filter width in pixels, expects odd number (counts center pixel)
192 // threshold - Rising and falling edge threshold
193 // widthThreshold - Used for width calculation, only pixels with an intensity greater than baseIntensity + widthThreshold are accepted.
194 // minWidth - minimum spot width
195 // maxWidth - maximum spot width
196 // minSum - minimum spot sum
197 // Outputs:
198 // spots - returns detected spot objects, expects an initialized array of type kTYPE_SPOT, kTypeOf(kFpgaSpot), or kTypeOf(kFpgaWideSpot)
199 // with capacity equal to maximum expected number of spots
200 // bounds - returns x coordinates of rising and falling edge spot boundaries, expects an initialized array of type kTYPE_POINT_32S or kNIL
201 // edgeImage - returns the gradient image, expects an initialized image of pixel type kTypeOf(k8s) of size equal to the input image or kNIL
202 
203 kFsFx(kStatus) kSpot_SobelArcgV1(kImage image, k32u averageWindow, k32u edgeWindow, k32u threshold, k32u widthThreshold, k32u minWidth,
204  k32u maxWidth, k32u minSum, kArrayList spots, kArrayList bounds, kImage edgeImage);
205 
206 // kSpot_SobelAccg
207 //
208 // Description:
209 // Performs Sobel-filtered ACCG spot detection
210 // Inputs:
211 // image - input kImage data to be processed, expects pixel type kTypeOf(k8s)
212 // averageWindow - Sobel filter width in pixels
213 // edgeWindow - Sobel filter height in pixels, expects odd number (counts center pixel)
214 // threshold - Rising and falling edge threshold
215 // widthThreshold - Used for width calculation, only pixels with an intensity greater than baseIntensity + widthThreshold are accepted.
216 // minWidth - minimum spot width
217 // maxWidth - maximum spot width
218 // minSum - minimum spot sum
219 // Outputs:
220 // spots - returns detected spot objects, expects an initialized array of type kTYPE_SPOT, kTypeOf(kFpgaSpot), or kTypeOf(kFpgaWideSpot)
221 // with capacity equal to maximum expected number of spots
222 // bounds - returns centroid coordinates of rising and falling edge spot boundaries, expects an initialized array of type kTYPE_POINT_32S or kNIL
223 // edgeImage - returns the gradient image, expects an initialized image of pixel type kTypeOf(k8s) of size equal to the input image or kNIL
224 
225 kFsFx(kStatus) kSpot_SobelAccg(kImage image, k32u averageWindow, k32u edgeWindow, k32u threshold, k32u widthThreshold, k32u minWidth,
226  k32u maxWidth, k32u minSum, kArrayList spots, kArrayList bounds, kImage edgeImage);
227 
228 kFsFx(kStatus) kSpot_YGradient(kImage input, k32u averageWindow, k32u edgeWindow, kImage output);
229 kFsFx(kStatus) kSpot_XGradient(kImage input, k32u averageWindow, k32u edgeWindow, kImage output);
230 
231 kFsFx(kStatus) kSpot_Sort(kArrayList spots, kArrayList sortedSpots, kSize sortedSpotCount, kCameraSpotSort sortType, kBool inverted);
232 
233 typedef struct
234 {
235  k32u center_width; /* end in 16.8 fixed point format, and width */
236  k16u slice; /* slice index */
237  k16u sum_misc; /* pixel intensity sum and misc info */
238 } kFpgaSpot;
239 
240 #define kFPGA_SPOT_SPOT_WIDTH_MASK kxFPGA_SPOT_SPOT_WIDTH_MASK
241 #define kFPGA_SPOT_SPOT_WIDTH_SHIFT kxFPGA_SPOT_SPOT_WIDTH_SHIFT
242 
243 #define kFPGA_SPOT_CENTER(CG) kxFPGA_SPOT_CENTER(CG)
244 #define kFPGA_SPOT_SPOT_WIDTH(CG) kxFPGA_SPOT_SPOT_WIDTH(CG)
245 #define kFPGA_SPOT_SLICE(CG) kxFPGA_SPOT_SLICE(CG)
246 #define kFPGA_SPOT_EMPTY(CG) kxFPGA_SPOT_EMPTY(CG)
247 #define kFPGA_SPOT_SUM(CG) kxFPGA_SPOT_SUM(CG)
248 #define kFPGA_SPOT_SOBEL_P2P(CG) kxFPGA_SPOT_SOBEL_P2P(CG)
249 #define kFPGA_SPOT_IS_COLUMN(CG) kxFPGA_SPOT_IS_COLUMN(CG)
250 #define kFPGA_SPOT_IS_ROW(CG) kxFPGA_SPOT_IS_ROW(CG)
251 
252 typedef struct
253 {
254  k32u center_width; /* end in 16.8 fixed point format, and width */
255  k16u slice; /* slice index */
256  k16u sum_misc; /* pixel intensity sum and misc info */
257 } kFpgaWideSpot;
258 
259 #define kFPGA_WIDE_SPOT_CENTER(CG) kxFPGA_WIDE_SPOT_CENTER(CG)
260 #define kFPGA_WIDE_SPOT_SPOT_WIDTH(CG) kxFPGA_WIDE_SPOT_SPOT_WIDTH(CG)
261 #define kFPGA_WIDE_SPOT_SLICE(CG) kxFPGA_WIDE_SPOT_SLICE(CG)
262 #define kFPGA_WIDE_SPOT_EMPTY(CG) kxFPGA_WIDE_SPOT_EMPTY(CG)
263 #define kFPGA_WIDE_SPOT_SUM(CG) kxFPGA_WIDE_SPOT_SUM(CG)
264 #define kFPGA_WIDE_SPOT_SOBEL_P2P(CG) kxFPGA_WIDE_SPOT_SOBEL_P2P(CG)
265 #define kFPGA_WIDE_SPOT_IS_COLUMN(CG) kxFPGA_WIDE_SPOT_IS_COLUMN(CG)
266 #define kFPGA_WIDE_SPOT_IS_ROW(CG) kxFPGA_WIDE_SPOT_IS_ROW(CG)
267 
268 kEndHeader()
269 
270 #include <kFireSync/Data/kSpot.x.h>
271 
272 #endif
Represents a CSum value in the format produced by the Binarize-CSum camera algorithm (version 4)...
Definition: kSpot.h:61
Represents camera algorithm spot sort options.
Essential declarations related to FireSync nodes.
k32u csum
Column sum fields.
Definition: kSpot.h:63
Essential API declarations for the kFireSync library.