Search code examples
matlabimage-processingbicubic

MATLAB, even if i use the wrong code in imresize, but it will be executed


I used bicubic as a method when using imresize in MATLAB

This is the code.

a = imresize (image, 1/3, 'bicubic');
b = imresize (a, 3, 'bicubic');

It works well.

But I was wondering if I made a mistake and changed the method

a = imresize (image, 1/3, 'bic');
b = imresize (a, 3, 'bic');

I did this.

But the code is executed and the result is the same.

Do not i get an error if i use 'bic'?

Because this worked, I suspected that my experiment data was correct.

Why is it running normally?

Thank you.


Solution

  • As @AnderBiguri suggests, someone at Mathworks does the job in such a way you can enter the beginning of the method. If you read the code of imresize, you can find the following function at line 445 (RS2017b):

    function tf = isMethodString(in)
    % abbreviated for sake of clarity
    tf = sum(strncmpi(in, valid_method_strings, numel(in));
    

    It validates the method if the first characters identify the method uniquely (and case insensitive). So 'b' is not valid (since you have 'bilinear' and 'bicubic'), but 'bic' is valid, so as 'n' (for 'nearest').