|
template<unsigned int tPatchSize> |
static bool | trackPointsInPyramidMirroredBorder (const Frame &previousFrame, const Frame ¤tFrame, const PixelPositions &previousPoints, const PixelPositions &roughPoints, PixelPositions ¤tPoints, const unsigned int maximalOffset, const unsigned int coarsestLayerRadiusX, const unsigned int coarsestLayerRadiusY, const FramePyramid::DownsamplingMode downsamplingMode=FramePyramid::DM_FILTER_14641, Worker *worker=nullptr, std::vector< uint32_t > *metricResults=nullptr, std::vector< uint32_t > *metricIdentityResults=nullptr) |
| Tracks a set of given points between two frames with pixel accuracy. More...
|
|
template<unsigned int tPatchSize> |
static bool | trackPointsInPyramidMirroredBorder (const FramePyramid &previousPyramid, const FramePyramid ¤tPyramid, const PixelPositions &previousPoints, const PixelPositions &roughPoints, PixelPositions ¤tPoints, const unsigned int coarsestLayerRadiusX, const unsigned int coarsestLayerRadiusY, Worker *worker=nullptr, std::vector< uint32_t > *metricResults=nullptr, std::vector< uint32_t > *metricIdentityResults=nullptr) |
| Tracks a set of given points between two frame pyramids, with pixel accuracy. More...
|
|
template<unsigned int tChannels, unsigned int tPatchSize> |
static PixelPosition | pointMotionInFrameMirroredBorder (const uint8_t *const frame0, const uint8_t *const frame1, const unsigned int width0, const unsigned int height0, const unsigned int width1, const unsigned int height1, const PixelPosition &position0, const unsigned int radiusX, const unsigned int radiusY, const unsigned int frame0PaddingElements, const unsigned int frame1PaddingElements, const PixelPosition &rough1=PixelPosition(), uint32_t *const metricResult=nullptr, uint32_t *const metricIdentityResult=nullptr) |
| Determines the motion for one given point between two frames by application of an image patch. More...
|
|
template<unsigned int tPatchSize> |
static PixelPosition | pointMotionInFrameMirroredBorder (const uint8_t *const frame0, const uint8_t *const frame1, const unsigned int channels, const unsigned int width0, const unsigned int height0, const unsigned int width1, const unsigned int height1, const PixelPosition &position0, const unsigned int radiusX, const unsigned int radiusY, const unsigned int frame0PaddingElements, const unsigned int frame1PaddingElements, const PixelPosition &rough1=PixelPosition(), uint32_t *const metricResult=nullptr, uint32_t *const metricIdentityResult=nullptr) |
| Determines the motion for one given point between two frames by application of an image patch. More...
|
|
template<typename TMetric = SumSquareDifferences>
class Ocean::CV::Motion< TMetric >
This class implements patch-based motion techniques.
- Template Parameters
-
TMetric | The metric that is applied for measurements with pixel accuracy |
- See also
- MotionSAD, MotionSSD, MotionZeroMeanSSD.
template<typename TMetric >
template<unsigned int tChannels, unsigned int tPatchSize>
PixelPosition Ocean::CV::Motion< TMetric >::pointMotionInFrameMirroredBorder |
( |
const uint8_t *const |
frame0, |
|
|
const uint8_t *const |
frame1, |
|
|
const unsigned int |
width0, |
|
|
const unsigned int |
height0, |
|
|
const unsigned int |
width1, |
|
|
const unsigned int |
height1, |
|
|
const PixelPosition & |
position0, |
|
|
const unsigned int |
radiusX, |
|
|
const unsigned int |
radiusY, |
|
|
const unsigned int |
frame0PaddingElements, |
|
|
const unsigned int |
frame1PaddingElements, |
|
|
const PixelPosition & |
rough1 = PixelPosition() , |
|
|
uint32_t *const |
metricResult = nullptr , |
|
|
uint32_t *const |
metricIdentityResult = nullptr |
|
) |
| |
|
static |
Determines the motion for one given point between two frames by application of an image patch.
Patch pixels outside the frame are mirrored into the frame before comparison.
- Parameters
-
frame0 | The first frame, must be valid |
frame1 | The second frame, must be valid |
width0 | Width of the first frame in pixel, with range [tPatchSize/2, infinity) |
height0 | Height of the first frame in pixel, with range [tPatchSize/2, infinity) |
width1 | Width of the second frame in pixel, with range [tPatchSize/2, infinity) |
height1 | Height of the second frame in pixel, with range [tPatchSize/2, infinity) |
position0 | The position in the first frame, with range [0, width - 1]x[0, height - 1] |
radiusX | The search radius in horizontal direction, in pixel, with range [0, width - 1] |
radiusY | The search radius in vertical direction, in pixel, with range [0, height - 1] |
frame0PaddingElements | The number of padding elements at the end of each row of the first frame, in elements, with range [0, infinity) |
frame1PaddingElements | The number of padding elements at the end of each row of the second frame, in elements, with range [0, infinity) |
rough1 | The optional rough guess of the point in the second frame, an invalid position if unknown |
metricResult | Optional resulting matching quality of the applied metric, nullptr if the result does not matter |
metricIdentityResult | Optional resulting matching quality of the applied metric between both frames at the identity location (the previous and rough position), nullptr if the result does not matter |
- Returns
- Best matching position in the second frame
- Template Parameters
-
tChannels | The number of frame channels, with range [1u, infinity) |
tPatchSize | The size of the square patch (the edge length) in pixel, with range [3, infinity), must be odd, recommended is 5, 7, 15, 31, or 63 |
template<typename TMetric >
template<unsigned int tPatchSize>
bool Ocean::CV::Motion< TMetric >::trackPointsInPyramidMirroredBorder |
( |
const Frame & |
previousFrame, |
|
|
const Frame & |
currentFrame, |
|
|
const PixelPositions & |
previousPoints, |
|
|
const PixelPositions & |
roughPoints, |
|
|
PixelPositions & |
currentPoints, |
|
|
const unsigned int |
maximalOffset, |
|
|
const unsigned int |
coarsestLayerRadiusX, |
|
|
const unsigned int |
coarsestLayerRadiusY, |
|
|
const FramePyramid::DownsamplingMode |
downsamplingMode = FramePyramid::DM_FILTER_14641 , |
|
|
Worker * |
worker = nullptr , |
|
|
std::vector< uint32_t > * |
metricResults = nullptr , |
|
|
std::vector< uint32_t > * |
metricIdentityResults = nullptr |
|
) |
| |
|
static |
Tracks a set of given points between two frames with pixel accuracy.
Actually, this function simply creates two frame pyramids and invokes the corresponding function needing frame pyramid as parameters.
The motion is determined by application of an image patch centered around the point to be tracked.
The points are tracked unidirectional (from the previous frame to the current frame).
If a point is near the frame border, a mirrored image patch is applied
- Parameters
-
previousFrame | The previous frame in which the previous points are located, must be valid |
currentFrame | The current frame, with same pixel format and pixel orientation as the previous frame, must be valid |
previousPoints | The points that are located in the previous frame (the points to be tracked from the previous frame to the current frame), with ranges [0, previousFrame.width())x[0, previousFrame.height()) |
roughPoints | Rough locations of the previous points in the current frame (if known), otherwise simply provide the previous points again, one for each previous point, with ranges [0, currentFrame.width())x[0, currentFrame.height()) |
currentPoints | Resulting current points, that have been tracked from the previous frame to the current frame, with ranges [0, currentFrame.width())x[0, currentFrame.height()) |
maximalOffset | Maximal expected offset between two corresponding points in pixel, defined in the domain of previous/current frame, with range [1, infinity) |
coarsestLayerRadiusX | The search radius on the coarsest pyramid layer in horizontal direction, in pixel, with range [0, infinity) |
coarsestLayerRadiusY | The search radius on the coarsest pyramid layer in vertical direction, in pixel, with range [0, infinity) |
downsamplingMode | The down sampling mode that is applied to create the pyramid layers |
worker | Optional worker object to distribute the computation |
metricResults | Optional resulting matching quality of the applied metric, nullptr if the results do not matter |
metricIdentityResults | Optional resulting matching quality of the applied metric between both frames at the identity location (the previous and rough position), nullptr if the results do not matter |
- Returns
- True, if succeeded
- Template Parameters
-
tPatchSize | The size of the square patch (the edge length) in pixel, with range [3, infinity), must be odd, recommended is 5, 7, 15, 31, or 63 |
template<typename TMetric >
template<unsigned int tPatchSize>
bool Ocean::CV::Motion< TMetric >::trackPointsInPyramidMirroredBorder |
( |
const FramePyramid & |
previousPyramid, |
|
|
const FramePyramid & |
currentPyramid, |
|
|
const PixelPositions & |
previousPoints, |
|
|
const PixelPositions & |
roughPoints, |
|
|
PixelPositions & |
currentPoints, |
|
|
const unsigned int |
coarsestLayerRadiusX, |
|
|
const unsigned int |
coarsestLayerRadiusY, |
|
|
Worker * |
worker = nullptr , |
|
|
std::vector< uint32_t > * |
metricResults = nullptr , |
|
|
std::vector< uint32_t > * |
metricIdentityResults = nullptr |
|
) |
| |
|
static |
Tracks a set of given points between two frame pyramids, with pixel accuracy.
The points are tracked unidirectional (from the previous frame to the current frame).
The motion is determined by application of an image patch centered around the point to be tracked.
If a point is near the frame border, a mirrored image patch is applied.
- Parameters
-
previousPyramid | The frame pyramid of the previous frame in which the previous points are located, must be valid |
currentPyramid | The frame pyramid of the current frame, with same pixel format and pixel origin as the previous frame pyramid, must be valid |
previousPoints | The points that are located in the previous frame (the points to be tracked from the previous frame to the current frame), with ranges [0, previousPyramid.finestWidth())x[0, previousPyramid.finestHeight()) |
roughPoints | Rough locations of the previous points in the current frame (if known), otherwise simply provide the previous points again, one for each previous point, with ranges [0, currentPyramid.finestWidth())x[0, currentPyramid.finestHeight()) |
currentPoints | Resulting current points, that have been tracked from the previous frame to the current frame, with ranges [0, currentPyramid.finestWidth())x[0, currentPyramid.finestHeight()) |
coarsestLayerRadiusX | The search radius on the coarsest pyramid layer in horizontal direction, in pixel, with range [0, infinity) |
coarsestLayerRadiusY | The search radius on the coarsest pyramid layer in vertical direction, in pixel, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
metricResults | Optional resulting matching quality of the applied metric, nullptr if the results do not matter |
metricIdentityResults | Optional resulting matching quality of the applied metric between both frames at the identity location (the previous and rough position), nullptr if the results do not matter |
- Returns
- True, if succeeded
- Template Parameters
-
tPatchSize | The size of the square patch (the edge length) in pixel, with range [3, infinity), must be odd, recommended is 5, 7, 15, 31, or 63 |
template<typename TMetric >
template<unsigned int tPatchSize>
void Ocean::CV::Motion< TMetric >::trackPointsInPyramidMirroredBorderSubset |
( |
const FramePyramid * |
previousPyramid, |
|
|
const FramePyramid * |
currentPyramid, |
|
|
const unsigned int |
numberLayers, |
|
|
const PixelPositions * |
previousPoints, |
|
|
const PixelPositions * |
roughPoints, |
|
|
PixelPositions * |
currentPoints, |
|
|
const unsigned int |
coarsestLayerRadiusX, |
|
|
const unsigned int |
coarsestLayerRadiusY, |
|
|
uint32_t * |
metricResults, |
|
|
uint32_t * |
metricIdentityResults, |
|
|
const unsigned int |
firstPoint, |
|
|
const unsigned int |
numberPoints |
|
) |
| |
|
staticprotected |
Tracks a subset of given points between two frame pyramids.
The points are tracked unidirectional (from the previous frame to the current frame).
If a point is near the frame border, a mirrored image patch is applied.
- Parameters
-
previousPyramid | Previous frame pyramid |
currentPyramid | Current frame pyramid, with same frame type as the previous frame |
numberLayers | The number of pyramid layers that will be used for tracking, with range [1, min(pyramids->layers(), coarsest layer that match with the patch size)] |
previousPoints | A set of points that are located in the previous frame |
roughPoints | The rough points in the current frame (if known), otherwise the prevousPoints may be provided |
currentPoints | Resulting current points, that have been tracking between the two points |
coarsestLayerRadiusX | The search radius on the coarsest pyramid layer in horizontal direction, in pixel, with range [0, infinity) |
coarsestLayerRadiusY | The search radius on the coarsest pyramid layer in vertical direction, in pixel, with range [0, infinity) |
metricResults | Optional resulting results of the applied metric, nullptr if the results do not matter |
metricIdentityResults | Optional resulting results of the applied metric in both frames at the same previous position, nullptr if the results do not matter |
firstPoint | The first point to be handled, with range [0, numberPoints - 1] |
numberPoints | The number of points to handled, with range [1, infinity) |
- Template Parameters
-
tPatchSize | The size of the square patch (the edge length) in pixel, with range [3, infinity), must be odd, recommended is 5, 7, 15, 31, or 63 |