From: "Yumnam Kirani" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to pass a 2-D image to a function
Date: Tue, 31 Jan 2012 11:58:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <jg8l0i$kti$>
References: <jg7oha$v8$> <jg7qit$6le$> <jg7r03$7kr$>
Reply-To: "Yumnam Kirani" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1328011090 21426 (31 Jan 2012 11:58:10 GMT)
NNTP-Posting-Date: Tue, 31 Jan 2012 11:58:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1030755
Xref: comp.soft-sys.matlab:756250

"Sadik " <> wrote in message <jg7r03$7kr$>...
> 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 0-255 range.
> Best.

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.

Yumnam Kirani Singh
Tronglaobi Awang Leikai