OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 07 Feb 2017 10:21:25 -0600Why bicubic interpolation uses a 4x4 pixels neighborhood?http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/ Hello, I am just starting to learn about image interpolation. I already read some papers about it and I'm doing some tests applying the bicubic interpolation (INTER_CUBIC) using the **resize** function provided by the **OpenCV** library.
In 2 papers that I read, the authors wrote that the bicubic interpolation uses a neighborhood of 16x16 pixels, but in the **OpenCV** documentation, it says that the bicubic interpolation method uses a neighborhood of 4x4 pixels.
**Doc**: [http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html](http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html)
Can someone explain to me why it uses a 4x4 neighborhood? What is the main difference between using a 16x16 neighborhood and a 4x4 neighborhood?
Thanks in advance
**Note**: keep in mind that I'm a newbie.Sun, 05 Feb 2017 19:55:00 -0600http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/Answer by LBerger for <p>Hello, I am just starting to learn about image interpolation. I already read some papers about it and I'm doing some tests applying the bicubic interpolation (INTER_CUBIC) using the <strong>resize</strong> function provided by the <strong>OpenCV</strong> library.</p>
<p>In 2 papers that I read, the authors wrote that the bicubic interpolation uses a neighborhood of 16x16 pixels, but in the <strong>OpenCV</strong> documentation, it says that the bicubic interpolation method uses a neighborhood of 4x4 pixels.</p>
<p><strong>Doc</strong>: <a href="http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html">http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html</a></p>
<p>Can someone explain to me why it uses a 4x4 neighborhood? What is the main difference between using a 16x16 neighborhood and a 4x4 neighborhood?</p>
<p>Thanks in advance</p>
<p><strong>Note</strong>: keep in mind that I'm a newbie.</p>
http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/?answer=124991#post-id-124991 I cannot answer why but i can explain difference :
[bicubic interpolation](https://en.wikipedia.org/wiki/Bicubic_interpolation) is a function f with 16 parameters. To solve a such system with 16 unknown you need 16 data =4x4 neigborhood. It is smallest compact neighborhood.
Using this neigborhood you are sure f(j,i)=I(j,i) I image function (j,i ) pixel of coordinate column and row
Now you can take larger neighborhood but f(j,i)<>I(j,i)
An example with y=a x^2+ b x + c , 5 datas
x=[-2 -1 0 1 2]
y=[-5 -1 3 2 3.5]
Do you prefer red or green curve ?
![image description](/upfiles/14863673327406821.png)Mon, 06 Feb 2017 01:49:30 -0600http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/?answer=124991#post-id-124991Comment by Kelvin for <p>I cannot answer why but i can explain difference :</p>
<p><a href="https://en.wikipedia.org/wiki/Bicubic_interpolation">bicubic interpolation</a> is a function f with 16 parameters. To solve a such system with 16 unknown you need 16 data =4x4 neigborhood. It is smallest compact neighborhood. </p>
<p>Using this neigborhood you are sure f(j,i)=I(j,i) I image function (j,i ) pixel of coordinate column and row</p>
<p>Now you can take larger neighborhood but f(j,i)<>I(j,i)</p>
<p>An example with y=a x^2+ b x + c , 5 datas
x=[-2 -1 0 1 2]</p>
<p>y=[-5 -1 3 2 3.5]</p>
<p>Do you prefer red or green curve ? </p>
<p><img alt="image description" src="/upfiles/14863673327406821.png"/></p>
http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/?comment=125183#post-id-125183Thanks for the great explanation @LBerger.
The green curve seems to be smoother, am I right?Tue, 07 Feb 2017 08:59:16 -0600http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/?comment=125183#post-id-125183Comment by LBerger for <p>I cannot answer why but i can explain difference :</p>
<p><a href="https://en.wikipedia.org/wiki/Bicubic_interpolation">bicubic interpolation</a> is a function f with 16 parameters. To solve a such system with 16 unknown you need 16 data =4x4 neigborhood. It is smallest compact neighborhood. </p>
<p>Using this neigborhood you are sure f(j,i)=I(j,i) I image function (j,i ) pixel of coordinate column and row</p>
<p>Now you can take larger neighborhood but f(j,i)<>I(j,i)</p>
<p>An example with y=a x^2+ b x + c , 5 datas
x=[-2 -1 0 1 2]</p>
<p>y=[-5 -1 3 2 3.5]</p>
<p>Do you prefer red or green curve ? </p>
<p><img alt="image description" src="/upfiles/14863673327406821.png"/></p>
http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/?comment=125190#post-id-125190Yes it is.Tue, 07 Feb 2017 10:21:25 -0600http://answers.opencv.org/question/124958/why-bicubic-interpolation-uses-a-4x4-pixels-neighborhood/?comment=125190#post-id-125190