Thread Subject: imresize error

Subject: imresize error

From: Alfian Abdul Halin

Date: 16 Nov, 2009 08:02:04

Message: 1 of 5

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

Subject: imresize error

From: Alfian Abdul Halin

Date: 16 Nov, 2009 08:19:02

Message: 2 of 5

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

Subject: imresize error

From: Steve Eddins

Date: 16 Nov, 2009 12:38:01

Message: 3 of 5

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/

Subject: imresize error

From: Alfian Abdul Halin

Date: 16 Nov, 2009 13:17:18

Message: 4 of 5

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

Subject: imresize error

From: Steve Eddins

Date: 16 Nov, 2009 13:26:01

Message: 5 of 5

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/

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
imresize error ... Alfian Abdul Halin 16 Nov, 2009 03:04:03
rssFeed for this Thread

Contact us at files@mathworks.com