I’m trying to Debayer RGGB images using the nppiCFAToRGB functions in the NPP library. I’ve tested with both RG8 and RG10 format. My images are 1456x1088 effective resolution, with 1440x1080 recommended resolution. They are also 64 byte aligned. In the case of the RG10 images, this gives the following input parameters:

nSrcStep: 2944 bytes
oSrcSize: {1456, 1088}
oSrcRoi: {8, 4, 1440, 1080}
nDstStep: 8320 (1440 * 3 channels * 2 bytes per pixel)

Inputting these values gives me an output image with a black bar on the right and bottom side of the image (8 pixels and 4 pixels respectively). I’ve tried this with different size ROIs and offsets and seen the same result. It is as if the function is processing only the ROI width and height, then taking an offset snapshot.

E.g. If I gave an ROI of x = 200, y = 200, width = 400, height = 400, my output image would have the top left corner with valid data (the top 200x200 area) and the rest would be black. Again, this reinforces the idea that the function seems to be processing the {roi_width, roi_height} area only, then taking an {x,y} offset after.

Am I doing something incorrectly here? Has anyone else seen this issue? I do not have problems with ROI for any other NPP functions, but CFAToRGB uses a unique method of input for the ROI.

Here is an image to help visualize the problem: Imgur: The magic of the Internet