Coefficient computation for bicubic interpolation
古いコメントを表示
Dear Community Members,
Since bicubic interpolation for an image requires 16 coefficients which will eventually form the window with which we would convolve the sampled image, right. So my question is "how could I calculate these coefficients?". Do I have to get the matrix of the input image through matlab? If yes, how? Kindly don't suggest imread since it only shows how many rows and columns are present. If no, what is an exact way of computing the coefficients for bicubic interpolation?
Thanks in advance
回答 (1 件)
Normally, you would use interp2, griddedInterpolant, or the spline command to do bicubic interpolation.
Only in very special cases, like if you are interpolating at gridded sample points, can the operation be formulated as a convolution, and even then, griddedInterpolant probably does this for you internally.
18 件のコメント
mona
2012 年 11 月 20 日
Matt J
2012 年 11 月 20 日
Do you have an example of what you tried?
mona
2012 年 11 月 20 日
mona
2012 年 11 月 21 日
When you perform an interpolation operation, the locations at which you interpolate are the raw input data and are supposed to be known a priori by you. They are not something that gets computed over the course of the operation.
For example, if I have the data [10,20] and I associate them with the locations [1,2] and I want to interpolate at the locations [1.5,1.7], I would do as follows
>> interp1([1,2], [10 20], [1.5,1.7],'spline')
ans =
15 17
mona
2012 年 11 月 21 日
Matt J
2012 年 11 月 21 日
Well, your terminology is a bit confusing. I don't know why an "image" is something you consider a non-numerical thing. An image is just a 2D numerical array
However, here is what I suspect you want: I suspect you are given an image of dimensions NxN and you want to obtain an upsampled version of this image that is 8Nx8N. If that's the case, you would do
F=griddedInterpolant(yourImage,'cubic');
locations=linspace(1,N,8*N);
newImage=F({locations, locations});
mona
2012 年 11 月 21 日
Matt J
2012 年 11 月 21 日
What version of MATLAB do you have?
Matt J
2012 年 11 月 21 日
If you have an old version of MATLAB, you can also upsample by factors of 2^n by doing
newImage = interp2(yourImage,n, 'spline');
mona
2012 年 11 月 21 日
I assume you really meant to write
interp2(xs,3,'cubic');
mona
2012 年 11 月 21 日
Not sure why that's what you wnat. If you do interp2(xs,'cubic'), you will upsample xs by a factor of 2, whereas earlier you said you wanted to upsample by a factor of 8.
Anyway, if you don't like the result, it's either because your data is bad or else it's not very cubic.
mona
2012 年 11 月 21 日
My 2nd remark was referring to the factor-of-2 upsampling result, not the one that gave you an out-of-memory error.
Earlier, you said you thought that result looked distorted. If it looks distorted, the only thing to blame is either the data or the interpolation model.
mona
2012 年 11 月 22 日
カテゴリ
ヘルプ センター および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!