ROI rect sizes for NPP Projective Transform How to handle them? Function does nothing...

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?

Just to clarify, the warning I get is NPP_WRONG_INTERSECTION_QUAD_WARNING.
Can someone help?

2 Ygrene

Please specify the


values. The


can mean that the intersection of destination ROI with the source ROI being transformed with the coefficients, is void.