Why do I observe oscillations when using the "imresize" function with bilinear interpolation?
이전 댓글 표시
When I try to downsample my linear function using the "imresize" function and set the "method" attribute to "bilinear", I observe oscillations in the resultant downsampled data. I expected the downsampled data to remain linear, as the "bilinear" method should not alter the data's nature. I also observe oscillations with other interpolation methods in the "imresize" function.
The following example code illustrates the issue:
% Create a 2D linear test function with values ranging from 1 to 200
exampleTest = repmat(1:200, [200 1]);
% Downsample the test function to a 150x150 matrix using 'bilinear' interpolation
downsampledMatrix = imresize(exampleTest, [150 150], 'bilinear');
% Extract a row from the downsampled result
downsampledRow = downsampledMatrix(80, :);
% Visualize the downsampled data
figure;
plot(downsampledRow, '.');
title('Downsampled Row Data');
% Compute the difference between consecutive elements in the extracted row
% Expect a constant difference, but observe oscillations instead
rowDifferences = diff(downsampledRow);
% Plot the differences to visualize the oscillations
figure;
plot(rowDifferences, '.');
title('Difference Between Consecutive Elements (Oscillations)');
What could cause this issue?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!