Quantcast
Channel: Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1294

Resize Image using ROI Processing

$
0
0

I've been trying to update our video tiling (for displaying multiple input images in a single output image) implementation to support a particular scenario.  Simply put, I need to resize an input image of arbitrary dimensions / aspect ratio into a region (also of arbitrary dimensions / aspect ratios and position in the destination image) of an output / destination image (also of arbitrary dimensions / aspect ratios).  We have had much of this working for sometime with one key limitation, we have not tried cropping the source image.  The existing functionality works even after upgrading a while back to the newer ippiResizeNearest API.

I am now struggling to allow for cropping of the source image such that it fits into the destination region, maintaining the source image aspect ratio.  Let's say, for example, the source image is 720p, the  destination image is also 720p, and the destination region within the destination image is VGA (or something smaller with similar aspect ratio).  Since 720p is wider than VGA I want to crop the left and right of the source image and resize to fit into the region.  As far as I can tell, the only use case close to this has to do with tiling an image into n smaller images and resizing these tiles individually.  Seems more to enable parallel processing of the tiles.

Anyway, I have all the details needed for the source / destination ROI, source / destination offsets, etc., but the ippiResizeNearest (nor any other resize API I have found) does not accept the source offset, just the width / height of the ROI.  Is there something I am missing here?  I believe this was pretty easy to implement using the old 'resize square pixel' API.  The documentation seems to indicate the source ROI is driven off the destination ROI and you must retrieve the ROI and offsets with a 'get' API.

Given a simple example . . .

Source image 1280x720

Output image 1280x720

Region in output image 600x360

Source ROI IppiRect {40, 0, 1200, 720} (x, y, w, h) - takes the center 1200 pixel width and full height

Destination ROI IppiRect {?, ? 600, 360} (x, y, w, h) - scales the cropped source by half and places in region (wherever it is located in destination image)


Viewing all articles
Browse latest Browse all 1294

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>