From: Alfian Abdul Halin on
Hi :) I am facing an error when using imresize.
It seems to be giving me problems when dealing with binary images. The error message that comes out is:

??? X must be (Ny x Nx) in UINT8 format

I am perplexed why this happens.

an example code that I write is like this:

a = imerad('pic.jpg');
b = im2bw(a);
c = imresize(b,0.25);
.... then ===> ??? X must be (Ny x Nx) in UINT8 format

Btw... while writing, i thought of testing imresize when it does not give me error.
The results are quite surprising... Just tried this just now...

a = imread('pic.jpg');
b = imresize(a, 0.5);
..... b is returned as an empty matrix?

Can anyone help me? Much appreciated.

thanks.

ALFIAN
From: Alfian Abdul Halin on
BTW... I discovered an "imresize_old.m" in the matlab toolbox....
didn;t know it was there. It works though.
Just wondering why the imresize.m is failing me.
It works on my friend's PC....
From: Steve Eddins on
Alfian Abdul Halin wrote:
> Hi :) I am facing an error when using imresize.
> It seems to be giving me problems when dealing with binary images. The error message that comes out is:
>
> ??? X must be (Ny x Nx) in UINT8 format
>
> I am perplexed why this happens.
>
> an example code that I write is like this:
>
> a = imerad('pic.jpg');
> b = im2bw(a);
> c = imresize(b,0.25);
> ... then ===> ??? X must be (Ny x Nx) in UINT8 format
>
> Btw... while writing, i thought of testing imresize when it does not give me error.
> The results are quite surprising... Just tried this just now...
>
> a = imread('pic.jpg');
> b = imresize(a, 0.5);
> .... b is returned as an empty matrix?
>
> Can anyone help me? Much appreciated.
>
> thanks.
>
> ALFIAN

I suspect you have another function imresize on your path.

Do this to check:

which -all imresize

---
Steve Eddins
http://blogs.mathworks.com/steve/
From: Alfian Abdul Halin on
> I suspect you have another function imresize on your path.
>
> Do this to check:
>
> which -all imresize
>
> ---
> Steve Eddins
> http://blogs.mathworks.com/steve/

Hi Steve

Thanks for the tip.
After running the which command... The results were like this:
C:\Documents and Settings\Alfian\My Documents\MATLAB\myFolder\fdtool\imresize.dll
C:\Program Files\MATLAB\R2007a\toolbox\images\images\imresize.m % Shadowed
one .dll file... and the other one is the imresize.m file...
do you mean this sort of duplication?

I also did a Google Desktop search... and it only returned the :\Program Files\MATLAB\R2007a\toolbox\images\images\imresize.m ... no other imresize.m on my computer.

btw... imresize used to work ok before this. I just cannot put my hand on it on why its acting weird now...

PS:- now I'm using imresize_old.m (never knew it was there...... )
From: Steve Eddins on
Alfian Abdul Halin wrote:
>> I suspect you have another function imresize on your path.
>>
>> Do this to check:
>>
>> which -all imresize
>>
>> ---
>> Steve Eddins
>> http://blogs.mathworks.com/steve/
>
> Hi Steve
>
> Thanks for the tip.
> After running the which command... The results were like this:
> C:\Documents and Settings\Alfian\My Documents\MATLAB\myFolder\fdtool\imresize.dll
> C:\Program Files\MATLAB\R2007a\toolbox\images\images\imresize.m % Shadowed
> one .dll file... and the other one is the imresize.m file...
> do you mean this sort of duplication?
>
> I also did a Google Desktop search... and it only returned the :\Program Files\MATLAB\R2007a\toolbox\images\images\imresize.m ... no other imresize.m on my computer.
>
> btw... imresize used to work ok before this. I just cannot put my hand on it on why its acting weird now...
>
> PS:- now I'm using imresize_old.m (never knew it was there...... )

The function you are running and that is giving the strange error and
results is the one in ...\myFolder\fdtool.

That's what "Shadowed" means on the line for imresize.m in the Image
Processing Toolbox. That function doesn't get run, because another
function with the same name is ahead of it on the MATLAB search path.

---
Steve Eddins
http://blogs.mathworks.com/steve/