Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6734 Discussions

## How to get source bounds for target bounds for AffineTransform

Beginner
424 Views

I'm using WarpAffineLinear to rotate a image.

Using tiles for parallel processing works fine, except when my source image its not full in continued memory. For this cases source region it's need but I can't find any function to request for the source image area that would be used to compute the transform in a target area. Of course I can use a inverse transform for this but I would never now witch area it's need with precession and more if bordertype its ippBorderRepl and target ROI it's out of the source image.

In any case this calculations are made internally by the library so it should be accessible, for this cases as it's available for resize using ippiResizeGetSrcRoi functions.

Regards

Alexander Brazda

Employee
424 Views

Hi Alexander,

To compute source ROI for the processed destination tile for WarpAffine with Linear interpolation you can use the function ippiGetAffineBound for the inverse transform. This function computes vertex coordinates of the smallest bounding rectangle for the transformed ROI.

The source ROI can be computed by the following formulas:

```IppiRect srcRoi;
srcRoi.x = floor(bound[0][0]);
srcRoi.y = floor(bound[0][1]);
srcRoi.width  = ceil(bound[1][0]) + 1 - srcRoi.x;
srcRoi.height = ceil(bound[1][1]) + 1 - srcRoi.y;```

Best regards,
V
alentin