GoWebScan API
 All Classes Files Functions Variables Typedefs Macros Modules Pages
GoWebScanVisionResampler.h
Go to the documentation of this file.
1 /**
2 * @file GoWebScanVisionResampler.h
3 * @brief Declares a GoWebScanVisionResampler object.
4 *
5 * @internal
6 * Copyright (C) 2017-2021 by LMI Technologies Inc.
7 * Licensed under the MIT License.
8 * Redistributed files must retain the above copyright notice.
9 */
10 
11 #ifndef GO_WEB_SCAN_VISION_RESAMPLER_H
12 #define GO_WEB_SCAN_VISION_RESAMPLER_H
13 
15 
16 /**
17  * @class GoWebScanVisionResampler
18  * @extends kObject
19  * @ingroup GoWebScanSdk-Algorithms
20  * @brief Represents an algorithm for producing uniform-resolution resampled vision
21  * output given input terrian and demosaiced color vision tiles.
22  *
23  * Algorithm steps:
24  * -# When processing an input image, each of the output rows that fall within its Y-location
25  * limits is considered. Output rows that fall within this region are processed one at a time;
26  * if the row has not been previously considered, its pixels are first cleared.
27  * -# For each pixel in a particular output row, the corresponding terrain Z value is first
28  * looked up.
29  * -# Using the xRes(z) and yRes(z) functions provided by GoWebScanConfigNode, and the known
30  * terrain Z value, the image resolutions are calculated. Using the image X-center
31  * (GoWebScanConfigNode), image Y-center (image stamp), and Y-offsets (GoWebScanConfigNode),
32  * the address of the input pixel that best matches the location of the desired output pixel
33  * is calculated.
34  * -# When input images overlap, the pixels from each image are averaged together in the
35  * output buffer. This implies that rows in the output buffer should be retained until the
36  * trailing Y-location limit of the next input image is known; rows prior to the limit will no
37  * longer be modified and can be emitted.
38  */
40 
41 /**
42  * @struct GoWebScanVisionResamplerParams
43  * @extends kValue
44  * @ingroup GoWebScanSdk-Algorithms
45  * @brief Represents parameters of the vision Y-resampler algorithm.
46  */
48 {
49  kSSize imageWidth; ///< Expected width of vision images (pixels).
50  kSSize imageHeight; ///< Expected height of vision images (pixels).
51  k32s xCenter; ///< Center of vision node in system coords (mils).
52  GoWebScanLinearFunction xResAsZ; ///< Vision X resolution to Z fit as taken from sensor's GoGeoCal file.
53  GoWebScanLinearFunction yResAsZ; ///< Vision Y resolution to Z fit as taken from sensor's GoGeoCal file.
54  k32s zMaximum; ///< Expected maximum Z value produced by profile sensors in system. Typically selected to be max of sensor's FOV.
55  kSSize xStartPix; ///< Start of resampled data in system coords (pixels).
56  kSSize xCountPix; ///< Count of resampled pixels in X (pixels).
57  k32s xResolution; ///< Expected X-resolution of resampled output data (mils/pixel).
58  k32s yResolution; ///< Expected Y-resolution of resampled output data (mils/pixel).
59  k32s terrainXSubsampling; ///< Terrian X-resolution is determined by this field (vision-x-resolution shifted right by terrainXSubsampling).
60  kSSize yTilePix; ///< Expected Y-extent of vision tiles (pixels).
61  k32s breakDistance; ///< Vision messages with a Y position greater than this threshold from the current message will be cleared and recycled (mils).
63 
64 /** Defines the signature for the handler for accepting the output resampled rows. */
65 typedef kStatus(kCall *GoWebScanVisionResamplerDataFx)(kPointer context, k64s rowIndex, const GoWebScanInputAttr* attributes, const kRgb* points, kSSize pointCount);
66 
67 /**
68 * Constructs a GoWebScanVisionResampler object.
69 *
70 * @public @memberof GoWebScanVisionResampler
71 * @param resampler Receives the constructed GoWebScanVisionResampler object.
72 * @param args Algorithm parameters.
73 * @param yOffsets Y-offsets for each spot (mils). Calculated during system calibration.
74 * @param allocator Memory allocator (or kNULL for default).
75 * @return Operation status.
76 */
77 GoWebScanFx(kStatus) GoWebScanVisionResampler_Construct(GoWebScanVisionResampler* resampler, const GoWebScanVisionResamplerParams* args, const k32s* yOffsets, kAlloc allocator);
78 
79 /**
80 * Sets the handler for accepting the processed resampled rows from the algorithm.
81 *
82 * @public @memberof GoWebScanVisionResampler
83 * @param resampler GoWebScanVisionResampler object.
84 * @param data Callback function
85 * @param context Receiver argument for callback.
86 * @return Operation status.
87 */
89 
90 /**
91  * Runs the vision resampler algorithm on a vision tile and set of terrain tiles that are matched (in Y).
92  *
93  * @public @memberof GoWebScanVisionResampler
94  * @param resampler GoWebScanVisionResampler object.
95  * @param stamp Input vision tile stamp.
96  * @param vision Input vision image. Type kRgb.
97  * @param terrain Pointer to start of buffer of terrain tiles matched in Y to vision image.
98  * @param terrainInputs Pointer to start of buffer of terrain tile inputs.
99  * @param terrainCount Count of matched terrain tiles.
100  * @param terrainTile Terrain position (mils).
101  * @return Operation status.
102  */
103 GoWebScanFx(kStatus) GoWebScanVisionResampler_Process(GoWebScanVisionResampler resampler, const GoWebScanMsgStamp* stamp, kImage vision, kArray2* terrain, kArray1* terrainInputs, kSSize terrainCount, k64s terrainTile);
104 
105 /**
106 * Clears internal buffers and resets the algorithm.
107 *
108 * @public @memberof GoWebScanVisionResampler
109 * @param resampler GoWebScanVisionResampler object.
110 * @return Operation status.
111 */
113 
114 #include <GoWebScanSdk/GoWebScanVisionResampler.x.h>
115 
116 #endif
Represents coefficients of a linear fit. The fit can be applied as follows: y(x) = c1*x + c0...
Definition: GoWebScanSdkDef.h:507
k32s yResolution
Expected Y-resolution of resampled output data (mils/pixel).
Definition: GoWebScanVisionResampler.h:58
GoWebScanLinearFunction xResAsZ
Vision X resolution to Z fit as taken from sensor's GoGeoCal file.
Definition: GoWebScanVisionResampler.h:52
k32s terrainXSubsampling
Terrian X-resolution is determined by this field (vision-x-resolution shifted right by terrainXSubsam...
Definition: GoWebScanVisionResampler.h:59
kSSize xStartPix
Start of resampled data in system coords (pixels).
Definition: GoWebScanVisionResampler.h:55
kStatus GoWebScanVisionResampler_Clear(GoWebScanVisionResampler resampler)
Clears internal buffers and resets the algorithm.
kSSize imageWidth
Expected width of vision images (pixels).
Definition: GoWebScanVisionResampler.h:49
kSSize xCountPix
Count of resampled pixels in X (pixels).
Definition: GoWebScanVisionResampler.h:56
k32s breakDistance
Vision messages with a Y position greater than this threshold from the current message will be cleare...
Definition: GoWebScanVisionResampler.h:61
Essential GoWebScan declarations.
Represents parameters of the vision Y-resampler algorithm.
Definition: GoWebScanVisionResampler.h:47
kStatus(kCall * GoWebScanVisionResamplerDataFx)(kPointer context, k64s rowIndex, const GoWebScanInputAttr *attributes, const kRgb *points, kSSize pointCount)
Defines the signature for the handler for accepting the output resampled rows.
Definition: GoWebScanVisionResampler.h:65
Represents a message stamp containing properties of a message.
Definition: GoWebScanSdkDef.h:477
k32s xCenter
Center of vision node in system coords (mils).
Definition: GoWebScanVisionResampler.h:51
kSSize imageHeight
Expected height of vision images (pixels).
Definition: GoWebScanVisionResampler.h:50
kStatus GoWebScanVisionResampler_Process(GoWebScanVisionResampler resampler, const GoWebScanMsgStamp *stamp, kImage vision, kArray2 *terrain, kArray1 *terrainInputs, kSSize terrainCount, k64s terrainTile)
Runs the vision resampler algorithm on a vision tile and set of terrain tiles that are matched (in Y)...
Represents the attributes of an input GoWebScan message object. These values are copied from the raw ...
Definition: GoWebScanSdkDef.h:520
kStatus GoWebScanVisionResampler_SetDataHandler(GoWebScanVisionResampler resampler, GoWebScanVisionResamplerDataFx data, kPointer context)
Sets the handler for accepting the processed resampled rows from the algorithm.
k32s xResolution
Expected X-resolution of resampled output data (mils/pixel).
Definition: GoWebScanVisionResampler.h:57
Represents an algorithm for producing uniform-resolution resampled vision output given input terrian ...
kStatus GoWebScanVisionResampler_Construct(GoWebScanVisionResampler *resampler, const GoWebScanVisionResamplerParams *args, const k32s *yOffsets, kAlloc allocator)
Constructs a GoWebScanVisionResampler object.
GoWebScanLinearFunction yResAsZ
Vision Y resolution to Z fit as taken from sensor's GoGeoCal file.
Definition: GoWebScanVisionResampler.h:53
kSSize yTilePix
Expected Y-extent of vision tiles (pixels).
Definition: GoWebScanVisionResampler.h:60
k32s zMaximum
Expected maximum Z value produced by profile sensors in system. Typically selected to be max of senso...
Definition: GoWebScanVisionResampler.h:54