Why do I observe oscillations when using the "imresize" function with bilinear interpolation?
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!