 Mark as New
 Bookmark
 Subscribe
 Mute
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
I'm trying to write a 2D matrix interpolator using ResizeSqrPixel without success. I try to use axes information to compute the ROI of original and interpolated version but I obtain matrix with huge quantity of not allocated value. Also in the very simple case without ROI shift I obtain the same results.
To determine the size of the calling I use the higher dimension between the original and the interpolated matrix
the code used is similar to this one
m_maxRange=IPPI_MAX(i_inputRange,i_outputRange);
m_maxAzimuth=IPPI_MAX(i_inputAzimuth,i_outputAzimuth);
IppiSize size = {m_maxRange,m_maxAzimuth};
IppiRect drect = {0,0,i_outputRange,i_outputAzimuth};
IppiRect srect = {0,0,i_inputRange,i_inputAzimuth};
SetSrcROI(srect);
SetDestROI(drect);
Ipp8u *buf;
int bufsize;
IppStatus status = ippStsNoErr;
IppiSize roi = {i_inputRange,i_inputAzimuth};
/* calculation of work buffer size */
ippiResizeGetBufSize_64f( srect, drect, 1, i_method, &bufsize );
/* memory allocate */
buf = ippsMalloc_8u( bufsize );
status = ippiResizeSqrPixel_64f_C1R(
are_core::os::reinterpret_ptr
are_core::os::reinterpret_ptr
m_xFactor, m_yFactor, m_xShift, m_yShift, i_method, buf );
Could you please give me a hint ? there is something wrong in ROI or IPPISize?
Thanks in advance
Michele
Link Copied
 Mark as New
 Bookmark
 Subscribe
 Mute
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
However the comparison between matlab spline is not satisfactory. Do you suggest other function (at the moment performance are not an issue) to perform the interpolation?
If I would like to interpolate on axes how I can adjust xshift/yshift and xfactor/yfactor to perform interpolation on data from initial axis to final axis ? If I understand well axes should be regular it is correct?
Thanks
Michele
 Mark as New
 Bookmark
 Subscribe
 Mute
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
Sorry for missing the issue for so long time.
You may refer to the discussion
http://software.intel.com/enus/forums/showthread.php?t=65400&o=a&s=lr;
considerign the xshift/yshift (most of case, it is 0, 0 if interpolation Rect(0, 0, srcwidth, srcheight) to Rect(0, 0, dstwidth, dstheight)and xfactor/yfactor (which should be fixed too, dstwidth/srcwidth) .
But it may not comparsion between matabl spline as they may usingdifferent coefficients and algrithim. The algrithim of the intepolation of IPP, please refer to IPP manual.
Appendix B: Interpolation in Image Geometric Transform Functions
Linear Interpolation
This is the fastest and least accurate interpolation mode. The pixel value in the destination image is set to the value of the source image pixel closest to the point
(x_{S},y_{S}):D(x_{D},y_{D}) = S(round(x_{S}), round(y_{S})).
The linear interpolation is slower but more accurate than the nearest neighbor interpolation. On the other hand, it is faster but less accurate than cubic interpolation. The linear interpolation algorithm uses source image intensities at the four pixels (x_{S0}, y_{S0}), (x_{S1}, y_{S0}), (x_{S0}, y_{S1}), (x_{S1}, y_{S1}) that are closest to (x_{S}, y_{S}) in the source image:
x_{S0} = int(x_{S}), x_{S1} = x_{S0} + 1, y_{S0} = int(y_{S}), y_{S1} = y_{S0} + 1.
First, the intensity values are interpolated along the xaxis to produce two intermediate results I_{0} and I_{1} (see FigureLinear Interpolation):
I_{0} = S(x_{S}, y_{S0}) = S(x_{S0}, y_{S0})*(x_{S1}  x_{S}) + S(x_{S1}, y_{S0})*(x_{S}  x_{S0})
I_{1} = S(x_{S}, y_{S1}) = S(x_{S0}, y_{S1})*(x_{S1}  x_{S}) + S(x_{S1}, y_{S1})*(x_{S}  x_{S0}).
Then, the soughtfor intensity D(x_{D}, y_{D}) is computed by interpolating the intermediate values I_{0} and I_{1} along the yaxis:
D(x_{D}, y_{D}) = I_{0}*(y_{S1}  y_{S}) + I_{1}*(y_{S}  y_{S0}).
To use the linear interpolation, set the parameter interpolation to IPPI_INTER_LINEAR. For images with 8bit unsigned color channels, the functions ippiWarpAffine, ippiRotate, and ippiShear compute the coordinates (x_{S}, y_{S}) with the accuracy 2^{16} = 1/65536. For images with 16bit unsigned color channels, these functions compute the coordinates with floatingpoint precision.
Regards,
Ying
P.S If you'd like, you may try MKL (math kernal library), IPP's sister library. It providespline interpolation in the mathematical. Please see MKL doc : http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/index.htm
data fitting domain
Partition of interpolation interval [a, b] , where
 {x_{i}}_{i=1,...,n}, where a = x_{1} < x_{2}<... <x_{n} = b 
Vectorvalued function of dimension p being fit  (x) = (_{1}(x),..., _{p}(x)) 
Piecewise polynomial (PP) function of order k+1  (x) P_{i} (x), if x [ x_{i}, x_{i+1}), i = 1,..., n1 where

Function p agrees with function g at the points {x_{i}}_{i=1,...,n} .  For every point in sequence {x_{i}}_{i=1,...,n} that occurs m times, the equality p^{(i1)}() = g^{(i1)}() holds for all i = 1,...,m, where p^{(i)}(t) is the derivative of the ith order. 
The kth divided difference of function g at points x_{i},..., x_{i + k}. This difference is the leading coefficient of the polynomial of order k+1 that agrees with g at x_{i},..., x_{i + k}.  [ x_{i},..., x_{i + k}] g In particular,

A korder derivative of interpolant (x) at interpolation site . 
 Subscribe to RSS Feed
 Mark Topic as New
 Mark Topic as Read
 Float this Topic for Current User
 Bookmark
 Subscribe
 Printer Friendly Page