I want to warp a monochrome image of size 696 x 512 with nppiWarpPerspective_8u_C1R.
nppiWarpPerspective_8u_C1R(d_img, Size[696,512], d_img_step, Rect[0,0,696,512], d_warped, d_warped_step, Rect[0,0,696,512], Coefficients, NPPI_INTER_NN);
The sizes of the input NppiRect and NppiSize structs are given above. From this I get error code 2 (no transformation due to misaligned ROI which is outside of the image; can’t look up the description right now). So I must be doing something wrong with he size or rects, but I don’t know what.
It gets even stranger: when I change the first input Rect (Parameter 4) to [0,0,512,512] the transformation is done correctly, only with the right part of the image missing. Could be expected you say, and I indeed can increase the width to have the full image included, but the correct size is something like [0,0,589,512], which makes no sense to me. Then the transformed image looks correct. But why this size? And how to find it for other parameters? This behaviour makes no sense to me and it seems my original code should be correct.
What am I misunderstanding here?