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

IPP Resize Cubic result does not match with matlab imresize

Anchal_T_
Beginner
727 Views

Hi ,

I am using IPP 8.0 resize "ippiResizeCubic_8u_C1R" function . But my result does not match with matlab result.

( Input Matrix )  a =

     0     1     2     3     4
     5     6     7     8     9
    10    11    12    13    14
    15    16    17    18    19
    20    21    22    23    24

( Matlab Output )  b = imresize(a,2)

b =

   -0.4219   -0.1719    0.3750    0.8984    1.3984    1.8984    2.3984    2.9219    3.4688    3.7188
    0.8281    1.0781    1.6250    2.1484    2.6484    3.1484    3.6484    4.1719    4.7188    4.9688
    3.5625    3.8125    4.3594    4.8828    5.3828    5.8828    6.3828    6.9063    7.4531    7.7031
    6.1797    6.4297    6.9766    7.5000    8.0000    8.5000    9.0000    9.5234   10.0703   10.3203
    8.6797    8.9297    9.4766   10.0000   10.5000   11.0000   11.5000   12.0234   12.5703   12.8203
   11.1797   11.4297   11.9766   12.5000   13.0000   13.5000   14.0000   14.5234   15.0703   15.3203
   13.6797   13.9297   14.4766   15.0000   15.5000   16.0000   16.5000   17.0234   17.5703   17.8203
   16.2969   16.5469   17.0938   17.6172   18.1172   18.6172   19.1172   19.6406   20.1875   20.4375
   19.0313   19.2813   19.8281   20.3516   20.8516   21.3516   21.8516   22.3750   22.9219   23.1719
   20.2813   20.5313   21.0781   21.6016   22.1016   22.6016   23.1016   23.6250   24.1719   24.4219

IPP Output  

0     1    1    2    2    3     3    4    4   4

2     2     2   3    3   4      4    5     5   6

4     4     5   5    6   6      7    7    7      8

6      7     7     8     8    8    9   9  10   10

9      9   10   10     11   11  12  12  12  13

11    12   12   12    13   14   14  14  15 15

14   14    15   15    16   16   16  17 17   18

16   17   17   17    18    18   19  19  20   20

18    19   19   20    20   21  21   22   22  22

20   20   20   21    21  22   22   23  23  24

I wanted to understand why we have this difference. Thanks a lot

Regards,

Anchal

 

 

 

 

 

0 Kudos
3 Replies
Valentin_K_Intel
Employee
727 Views

Hi Anchal,

To correspond with Matlab it is required to set coefficients B = 0.f and C = 0.5f for ippiResizeCubicInit_8u function.
When the coefficients are set as described above, IPP output is:

    0    0    0    1   1    2    2    3    3   4  
    1    1    2    2   3    3    4    4    5   5  
    4    4    4    5   5    6    6    7    7   8  
    6    6    7    8   8    8    9  10  10  10  
    9    9    9  10  10  11  12  12  13  13  
   11  11  12  12  13  14  14  15  15  15  
   14  14  14  15  16  16  16  17  18  18  
   16  17  17  18  18  19  19  20  20  20  
   19  19  20  20  21  21  22  22  23  23  
   20  21  21  22  22  23  23  24  24  24

Best regards,
Valentin

0 Kudos
Anchal_T_
Beginner
727 Views

Hi ,

Please point me to any documentation which explains the use / impact of coefficients B = 0.f and C = 0.5f

Thanks,

Anchal

 

 

 

0 Kudos
Valentin_K_Intel
Employee
727 Views

Hi Anchal,

According to https://software.intel.com/en-us/node/505191 the reference for IPP bicubic interpolation implementation is the article "Reconstruction Filters in Computer Graphics". Don P. Mitchell, Arun N. Netravali. Computer Graphics, Volume 22, Number 4, AT&T Bell Laboratories, Murray Hill, New Jersey, August 1988.

According to http://uk.mathworks.com/matlabcentral/answers/78116-algorithm-of-bicubic-interpolation#answer_87815 the reference for Matlab bicubic interpolation implementation is the article "Cubic Convolution Interpolation for Digital Image % Processing", Robert G. Keys, IEEE Trans. on Acoustics, Speech, and % Signal Processing, Vol. 29, No. 6, Dec. 1981, pp. 1153-1160.

According to the formulas from the links above the coefficients for the function ippiResizeCubicInit_8u can be computed as B = 0.f and C = 0.5f

Best regards,
Valentin

0 Kudos
Reply