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