ONION
ONION

Reputation: 269

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.

Upvotes: 0

Views: 79

Answers (2)

Bentoy13
Bentoy13

Reputation: 4966

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').

Upvotes: 3

Molitoris
Molitoris

Reputation: 1035

Based on the matlab doc bicubic is the default value for this function. Probably, they check if the passed value is one of the predefined values. If this is not the case the default value ,which is bicubic, is applied.

Upvotes: 0

Related Questions