Community
cancel
Showing results for 
Search instead for 
Did you mean: 
dplong
Beginner
68 Views

Halving source-ROI x offset

Why must I divide the source-ROI x offset by two (then round to even number) for the function, ippiResizeYUV422_8u_C2R(), to behave correctly? Although I cannot find the units of x and y in the IppiRect struct documented anywhere, I would assume they both represent pixels.

Paul
0 Kudos
2 Replies
Joseph_S_Intel
Employee
68 Views

Yes pixels should be correct. You can find documentation here http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/ippxe/ipp_manual_lnx/ind... under image processing. Search for the function name and you will see a link to ROI Processing in Geometric Transforms that explains the use of ROIs in the function.

I've duplicated some of it here; hope this helps:

ROI Processing in Geometric Transforms

All the transform functions described in this chapter operate in rectangular regions of interest (ROIs) that are defined in both the source and destination images. The procedures for handling ROIs in geometric transform functions differ from those used in other functions (see Regions of Interest in Intel IPP). The main difference is that operations take place in the intersection of the transformed source ROI and the destination ROI. More specifically, all geometric transform functions (except those which perform inverse warping operations) handle ROIs with the following sequence of operations:

transform the rectangular ROI of the source image to quadrangle in the destination image;

find the intersection of this quadrangle and the rectangular ROI of the destination image;

update the destination image in the intersection area.

The coordinates in the source and destination images must have the same origin.

Using functions with ROI allows every scanline of a source image to be padded with zeroes for alignment, so that actual size of a scanline in bytes can be greater than it may be assumed from the image width. In that case the size of each row of image data in bytes is determined by the value of srcStep parameter, which gives distance in bytes between the starts of consecutive lines of an image.

To fully describe a rectangular ROI, both its origin (coordinates of top left corner) and size must be referenced. For geometrical transform functions, the source image ROI is specified by srcRoi parameter of IppiRect type, meaning that all four values describing the rectangular ROI are given explicitly.

On the other hand, the destination image ROI for different functions can be specified either by dstRoi parameter of IppiRect type, or dstRoiSize parameter of IppiSize type. In the latter case, only the destination ROI size is passed, while its origin is referenced by pDst pointer.

dplong
Beginner
68 Views

Thanks, Walter, but I've read that page many times. AFAIK, the IPP documentation does not identify the units of the x and y offsets of IppiRect.

Okay, so let's assume it's pixels. Do you have any idea why I have to divide x by two to make ippiResizeYUV422_8u_C2R() behave correctly? All of the examples I can find specify 0 as the x/y offsets. If I pass the actual pixel offset for x into the function, the function acts as if I have doubled the value. For example, if I pass an x (pixel) offset of 100 into ippiResizeYUV422_8u_C2R() as part of the srcROI argument, the resulting ROI is offset by 200.

Maybe this is a bug. Maybe the vast majority of folks just use this function to resize the entire image, and I am doing something atypical by specifying a source ROI that is not coincident with the source image.

Paul
Reply