Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

CopySubpixIntersect

Copies pixel values of the intersection with specified window with subpixel precision.

Syntax

Case 1: Copying without conversion or with conversion to floating point data

IppStatus ippiCopySubpixIntersect_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, IppiSize srcRoiSize, Ipp<dstDatatype>* pDst, int dstStep, IppiSize dstRoiSize, IppiPoint_32f point, IppiPoint* pMin, IppiPoint* pMax);

Supported values for mod:

8u_C1R 16u_C1R 32f_C1R
8u32f_C1R 16u32f_C1R  

Case 2: Copying with conversion to integer data

IppStatus ippiCopySubpixIntersect_8u16u_C1R_Sfs(const Ipp8u* pSrc, int srcStep, IppiSize srcRoiSize, Ipp16u* pDst, int dstStep, IppiSize dstRoiSize, IppiPoint_32f point, IppiPoint* pMin, IppiPoint* pMax, int scaleFactor);

Include Files

ippcv.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h, ippi.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.lib

Parameters

pSrc

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

srcRoiSize

Size of the source image ROI in pixels.

pDst

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the source and destination image.

dstRoiSize

Size of the destination ROI in pixels.

point

Center point of the window.

pMin

Pointer to coordinates of the top left pixel of the intersection in the destination image.

pMax

Pointer to coordinates of the bottom right pixel of the intersection in the destination image.

scaleFactor

Scale factor (see Integer Result Scaling).

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function determines the intersection of the source image and the window of size dstRoiSize centered in point point. The corresponding pixels of the destination image are calculated using linear interpolation (see Linear Interpolation in Appendix B) in accordance with the following formula:



where Xsubpix(j) = min(max(point.x + j - 0.5*(dstRoiSize.width - 1), 0), srcRoiSize.width - 1),

Ysubpix(i) = min(max(point.y + i - 0.5*(dstRoiSize.height - 1), 0), srcRoiSize.height - 1),

i = 0, ... dstRoiSize.height - 1 , j = 0, ... dstRoiSize.width - 1 .

Minimal values of j and i (coordinates of the top left calculated destination pixel) are assigned to pMin.x and pMin.y, maximal values (coordinates of the top left calculated destination pixel) - to pMin.x and pMin.y. (See Figure Image Copying with Subpixel Precision Using ippiCopySubpixIntersect Function.)

Image Copying with Subpixel Precision Using ippiCopySubpixIntersect Function



The height (width) of the destination ROI cannot be less than the sum of the height (width) of source ROI and the topBorderHeight (leftBorderWidth) parameter.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error condition if srcRoiSize or dstRoiSize has a field with a zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep is less than srcRoiSize.width * <pixelSize>, or dstStep is less than dstRoiSize.width * <pixelSize>.

Example

The code example below shows how to use the function ippiCopySubpixIntersect_8u_C1R.

Ipp8u src[8*6] = {
      7, 7, 6, 6, 6, 6, 7, 7,
      6, 5, 5, 5, 5, 5, 5, 6,
      6, 5, 4, 3, 3, 4, 5, 6,
      6, 5, 4, 3, 3, 4, 5, 6,
      6, 5, 5, 5, 5, 5, 5, 6,
      6, 6, 6, 6, 6, 6, 6, 6
    };
Ipp8u dst[7*4];
IppiSize srcRoi = { 8, 6 };
IppiSize dstRoi = { 7, 4 };
IppiPoint_32f point = { 4, 1 };
IppiPoint min;
IppiPoint max;
		
ippiCopySubpixIntersect_8u_C1R (src, 8, srcRoi, dst, 7, dstRoi, point, &min, &max );
		Results
source image:
7 7 6 6 6 6 7 7
6 5 5 5 5 5 5 6
6 5 4 3 3 4 5 6
6 5 4 3 3 4 5 6
6 5 5 5 5 5 5 6
6 6 6 6 6 6 6 6
		
destination image:
7 6 6 6 6 7 7
6 6 6 6 6 6 7
5 5 4 4 5 5 6
5 4 3 3 4 5 6
		
min = { 0, 1 }
max = { 5, 3 }