![]() |
VisionWorks Toolkit ReferenceDecember 18, 2015 | 1.2 Release |
Creates initial motion field from a current image into reference image.
This function calculates a sum-of-absolute-difference (SAD) value for each block position inside a search window and using a cost formulation, it picks the best two motion vectors to represent the displacement of the specified block into the reference image.
In addition to the motion vectors, this primitive also stores calculated SAD values for all \( B \times B \) pixel positions in the search window into a table; the values in the table then can be looked up instead of recomputed in refinement steps of the Iterative Motion Estimation algorithm.
For each \( B \times B \) block on the reference image, the primitive checks all pixels in \( SW \times SH \) search window on current image and calculates the cost value ( \( MV \) - motion vector between the \( B \times B \) block and current position in search window):
\[ cost(MV) = SAD(MV) + biasWeight * dist(MV, bias) \]
Then finds best motion vectors with minimum cost value in each subregions \( (0), (1,2), (3), (4, 8), (5, 6, 9, 10), (7, 11), (12), (13, 14), (15) \) of the search window:
Finally, selects two best motion vectors from different subregions, so that
\[ dist(MV0, MV1) >= mvDivFactor \]
Functions | |
vx_node | nvxCreateMotionFieldNode (vx_graph graph, vx_image ref_image, vx_image cur_image, vx_image anchor, vx_image bias, vx_image best_mv0, vx_image best_mv1, vx_image sad_table, vx_int32 blockSize, vx_int32 searchWindowWidth, vx_int32 searchWindowHeight, vx_float32 biasWeight, vx_int32 mvDivFactor) |
[Graph] Creates initial motion field from a current image into reference image. More... | |
vx_status | nvxuCreateMotionField (vx_context context, vx_image ref_image, vx_image cur_image, vx_image anchor, vx_image bias, vx_image best_mv0, vx_image best_mv1, vx_image sad_table, vx_int32 blockSize, vx_int32 searchWindowWidth, vx_int32 searchWindowHeight, vx_float32 biasWeight, vx_int32 mvDivFactor) |
[Immediate] Creates initial motion field from a current image into reference image. More... | |
vx_node nvxCreateMotionFieldNode | ( | vx_graph | graph, |
vx_image | ref_image, | ||
vx_image | cur_image, | ||
vx_image | anchor, | ||
vx_image | bias, | ||
vx_image | best_mv0, | ||
vx_image | best_mv1, | ||
vx_image | sad_table, | ||
vx_int32 | blockSize, | ||
vx_int32 | searchWindowWidth, | ||
vx_int32 | searchWindowHeight, | ||
vx_float32 | biasWeight, | ||
vx_int32 | mvDivFactor | ||
) |
[Graph] Creates initial motion field from a current image into reference image.
[in] | graph | Specifies the graph. |
[in] | ref_image | Specifies the reference image (8-bit grayscale). |
[in] | cur_image | Specifies the current image (8-bit grayscale). It must have the same size as ref_image . |
[in] | anchor | Specifies the optional anchor field. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. For each \( B \times B \) block on ref_image the anchor image contains an offset of search window on cur_image in Q14.2 format (NVX_DF_IMAGE_2S16). If the anchor parameter is missed, it is assumed that the offset is zero for all blocks. |
[in] | bias | Specifies the optional bias field. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. For each \( B \times B \) block on ref_image the bias image contains a bias vector for cost calculation in Q14.2 format (NVX_DF_IMAGE_2S16). If the bias parameter is missed, it is assumed that the bias vector is zero for all blocks. |
[out] | best_mv0 | Specifies the output image of the best motion vectors. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. The motion vectors will be stored in Q14.2 format (NVX_DF_IMAGE_2S16). Can be NULL if the primitive is used for SAD table calculation only. |
[out] | best_mv1 | Specifies the output image of the second best motion vectors. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. The motion vectors will be stored in Q14.2 format (NVX_DF_IMAGE_2S16). Can be NULL if the primitive is used for SAD table calculation only. |
[out] | sad_table | Specifies the optional output image with SAD table. It must have \( [W / B * SW * SH, H / B] \) size, where \( W \times H \) - ref_image size, \( SW \times SH \) - search window size, and \( B \) - block size. For each \( B \times B \) block on ref_image and for each position in search window the sad_table image contains SAD (sum of absolute diferences) value for corresponding blocks in U32 format (VX_DF_IMAGE_U32). The values are stored contiguously, i.e., first \( SW * SH \) values corresponds to the first block. Search window is treated in row major order started from top left corner. |
[in] | blockSize | Specifies the block size. |
[in] | searchWindowWidth | Specifies the search window width. |
[in] | searchWindowHeight | Specifies the search window height. Supported search window sizes: 16x16, 32x32, 64x64, 64x32, 32x16 and 48x32. |
[in] | biasWeight | Specifies the weight of bias term in cost formula. |
[in] | mvDivFactor | Specifies the best motion vectors diversity factor. |
vx_status nvxuCreateMotionField | ( | vx_context | context, |
vx_image | ref_image, | ||
vx_image | cur_image, | ||
vx_image | anchor, | ||
vx_image | bias, | ||
vx_image | best_mv0, | ||
vx_image | best_mv1, | ||
vx_image | sad_table, | ||
vx_int32 | blockSize, | ||
vx_int32 | searchWindowWidth, | ||
vx_int32 | searchWindowHeight, | ||
vx_float32 | biasWeight, | ||
vx_int32 | mvDivFactor | ||
) |
[Immediate] Creates initial motion field from a current image into reference image.
[in] | context | Specifies the context. |
[in] | ref_image | Specifies the reference image (8-bit grayscale). |
[in] | cur_image | Specifies the current image (8-bit grayscale). It must have the same size as ref_image . |
[in] | anchor | Specifies the optional anchor field. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. For each \( B \times B \) block on ref_image the anchor image contains an offset of search window on cur_image in Q14.2 format (NVX_DF_IMAGE_2S16). If the anchor parameter is missed, it is assumed that the offset is zero for all blocks. |
[in] | bias | Specifies the optional bias field. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. For each \( B \times B \) block on ref_image the bias image contains a bias vector for cost calculation in Q14.2 format (NVX_DF_IMAGE_2S16). If the bias parameter is missed, it is assumed that the bias vector is zero for all blocks. |
[out] | best_mv0 | Specifies the output image of the best motion vectors. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. The motion vectors will be stored in Q14.2 format (NVX_DF_IMAGE_2S16). Can be NULL if the primitive is used for SAD table calculation only. |
[out] | best_mv1 | Specifies the output image of the second best motion vectors. It must have \( [W / B, H / B] \) size, where \( W \times H \) - ref_image size and \( B \) - block size. The motion vectors will be stored in Q14.2 format (NVX_DF_IMAGE_2S16). Can be NULL if the primitive is used for SAD table calculation only. |
[out] | sad_table | Specifies the optional output image with SAD table. It must have \( [W / B * SW * SH, H / B] \) size, where \( W \times H \) - ref_image size, \( SW \times SH \) - search window size, and \( B \) - block size. For each \( B \times B \) block on ref_image and for each position in search window the sad_table image contains SAD (sum of absolute diferences) value for corresponding blocks in U32 format (VX_DF_IMAGE_U32). The values are stored contiguously, i.e., first \( SW * SH \) values corresponds to the first block. Search window is treated in row major order started from top left corner. |
[in] | blockSize | Specifies the block size. |
[in] | searchWindowWidth | Specifies the search window width. |
[in] | searchWindowHeight | Specifies the search window height. Supported search window sizes: 16x16, 32x32, 64x64, 64x32, 32x16 and 48x32. |
[in] | biasWeight | Specifies the weight of bias term in cost formula. |
[in] | mvDivFactor | Specifies the best motion vectors diversity factor. |
VX_SUCCESS | No errors. |
VX_ERROR_INVALID_REFERENCE | Supplied parameters are not a valid reference. |
VX_ERROR_INVALID_PARAMETERS | Supplied parameters are not valid. |
VX_ERROR_INVALID_SCOPE | Supplied parameters are virtual objects that cannot be used in immediate mode. |
VX_FAILURE | Internal error in primitive implementation, check log for detailed information (Framework: Log). |