[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function works with number literal but not with variable
From: |
John W. Eaton |
Subject: |
Re: Function works with number literal but not with variable |
Date: |
Wed, 16 Dec 2009 12:12:51 -0500 |
On 16-Dec-2009, George wrote:
| On Wed, Dec 16, 2009 at 11:36 AM, George <address@hidden> wrote:
| > imshow doesn't work if an image contains both positive and negative
| > values. So I tried to write a wrapper for imshow that will scale the
| > image so that all the elements are positive. So I call imshow from
| > within my function. The problem is that it doesn't work if I pass the
| > limits from variables, but it works if I type them as numbers. So this
| > code doesn't work:
| >
| > minVal = min(min(image));
| > maxVal = max(max(image));
| > [rows, columns] = size(image);
| > normalized = image - ones(rows,columns) * (minVal);
| > minVal = min(min(normalized));
| > maxVal = max(max(normalized)); % for my test image this is 44.2, I
| > can see it if I remove the semicolon
| > imshow(normalized, [0, maxVal]);
| >
| > But it works if I change the last line to this:
| >
| > imshow(normalized, [0, 44.2]);
| >
| > Two questions here:
| >
| > Why does this happen?
| > Why doesn't imshow work with images that have both positive and negative
values?
|
| I found that the problem was that my image was of type 'single'. If I
| convert it to 'double' imshow works. Is this a bug? I think so.
If you think you've found a bug, then please send a complete bug
report to the address@hidden list. Please see
http://www.octave.org/bugs.html to see what information you should
include in your report. At the very least, you should include the
version of Octave you are using, a complete example that can be used
to duplicate the problem, what you see when running your example, and
what you expect to see.
jwe
- Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable,
John W. Eaton <=
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, John W. Eaton, 2009/12/16
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, John W. Eaton, 2009/12/16
- Message not available
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, Judd Storrs, 2009/12/16
Re: Function works with number literal but not with variable, Sergei Steshenko, 2009/12/16