////////////////////////////////////////////////////////////////////////// \brief warp image with provided vector field For each output pixel there is a vector which tells which pixel from a source image should be mapped to this particular output pixel. It is assumed that images and the vector field have the same stride and resolution. \param[in] src source image \param[in] w width \param[in]
| 198 | /// \param[out] out warped image |
| 199 | /////////////////////////////////////////////////////////////////////////////// |
| 200 | static void WarpImage(const float *src, int w, int h, int s, const float *u, const float *v, float *out) |
| 201 | { |
| 202 | for (int i = 0; i < h; ++i) { |
| 203 | for (int j = 0; j < w; ++j) { |
| 204 | const int pos = j + i * s; |
| 205 | // warped coords |
| 206 | float x = (float)j + u[pos]; |
| 207 | float y = (float)i + v[pos]; |
| 208 | |
| 209 | out[pos] = Tex2D(src, w, h, s, x, y); |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /////////////////////////////////////////////////////////////////////////////// |
| 215 | /// \brief computes image derivatives for a pair of images |
no test coverage detected