http://www.mathworks.com/matlabcentral/newsreader/view_thread/316428
MATLAB Central Newsreader  How to pass a 2D image to a function
Feed for thread: How to pass a 2D image to a function
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Tue, 31 Jan 2012 03:52:10 +0000
How to pass a 2D image to a function
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316428#865277
Paul
Hi,<br>
<br>
I am getting the following error while passing a 2D image to a function<br>
<br>
Error using ==> mtimes<br>
MTIMES is not fully supported for integer classes. At least one input must be scalar.<br>
<br>
The error is at the following line<br>
<br>
G=T*newI;<br>
<br>
I checked the dimension, both are 8*8 matrices.<br>
<br>
Please help me out in this.Thank you in advance

Tue, 31 Jan 2012 04:27:09 +0000
Re: How to pass a 2D image to a function
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316428#865278
Sadik
Hi Paul, <br>
<br>
I don't know exactly what the problem is but at first glance, it says MTIMES is not fully supported for integer class. If I were you, I would try:<br>
<br>
G = double(T)*double(newl);<br>
<br>
Here, double() casts integer to double.<br>
<br>
Best.

Tue, 31 Jan 2012 04:34:11 +0000
Re: How to pass a 2D image to a function
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316428#865280
Sadik
Yes, I reproduced the problem. The matrix multiplication can result in values much larger than 255 [the uint8 max], so even if you use casting to double, you may want to make a decision about how to proceed with values outside the 0255 range.<br>
<br>
Best.

Tue, 31 Jan 2012 11:58:10 +0000
Re: How to pass a 2D image to a function
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316428#865300
Yumnam Kirani
"Sadik " <sadik.hava@gmail.com> wrote in message <jg7r03$7kr$1@newscl01ah.mathworks.com>...<br>
> Yes, I reproduced the problem. The matrix multiplication can result in values much larger than 255 [the uint8 max], so even if you use casting to double, you may want to make a decision about how to proceed with values outside the 0255 range.<br>
> <br>
> Best.<br>
<br>
If you simply want to assign all values greater than 255, you can simply use uint8 function. Otherwise, you need to scale the image after the multiplication to the desired range.<br>
<br>
Yumnam Kirani Singh<br>
Tronglaobi Awang Leikai<br>