이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Coefficient computation for bicubic interpolation
조회 수: 2 (최근 30일)
이전 댓글 표시
mona
2012년 11월 20일
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개)
Matt J
2012년 11월 20일
편집: Matt J
2012년 11월 20일
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일
Yes, here it is: bicubic=[1 4 6 4 1; 4 16 24 16 4; 6 24 36 24 6; 4 16 24 16 4; 1 4 6 4 1]; These coefficients were convolved with the input image later.
Using spline was trial and error thing and hence I wouldn't prefer to use it unless somebody could convince me to. This is because my results were horrible and not even close plus my input is an image and not a numerical data and hence I immediately assumed that spline wouldn't work for it. What are your suggestions on the filter? I basically filled in the repeated values wherever there were zeros.
Now how did I get these values? I basically made assumptions that since bicubic is parabolic in nature and hence the equation would be close to y=x^2.
mona
2012년 11월 21일
That's exactly my point in the question which I repeat: "how could I calculate these coefficients?" or more precisely relating to your comment, "how could I compute or know the locations at which the interpolation process needs to be carried out?"
Matt J
2012년 11월 21일
편집: Matt J
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일
This would have been fine given my input would have been numerical which is not the case since my input is an image. In case of an "Image", I am basically sampling it eight times after which I need to see the matrix of the image. Hence my next question already stated above, "Do I have to get the matrix of the input image through matlab? If yes, how?".
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일
First of all, Thanks for all your help.
Second, How does this method works. I'm trying to access it's functionality through help command but there's no documentation on it plus for some reason, this function is undefined in Matlab.
Third, I am trying to reconstruct an image using cubic interpolation. I have an image, I intentionally down sampled it ten times. Using this down sampled image, I am trying to reconstruct it using cubic interpolation.
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 have 7.9.0 R2009b, Maybe its not supported. Since I'm doing cubic interpolation instead of spline, interp2(xs,'cubic'); appeared appropriate but the image got even more distorted.
mona
2012년 11월 21일
No, I didn't mean to since 'n' is giving out of memory error even though the code itself makes sense.
Matt J
2012년 11월 21일
편집: Matt J
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일
It's not about ther result, I am not getting it at the first place with interp2(xs,3,'cubic'); I'm getting out of memory error.
Matt J
2012년 11월 21일
편집: Matt J
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
