[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #47516] image package: mat2gray rounding error
From: |
Avinoam Kalma |
Subject: |
[Octave-bug-tracker] [bug #47516] image package: mat2gray rounding errorrs when rescaling |
Date: |
Mon, 11 Apr 2016 20:55:24 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 |
Follow-up Comment #2, bug #47516 (project octave):
The Anonymous is right, the value in place of the original minimum is 1
instead of 0.
The problem is with the lines:
in(in <= out_min) = 0;
in(in >= out_max) = 1;
The value at the minimum is changed to 0, and since 0 is greater
than the original maximum, it changed again to 1. It will happen
in any negative matrix. The solution is:
idx_max = (in >= out_max);
in(in <= out_min) = 0;
in(idx_max) = 1;
and a simple test will check this situation:
%!assert(mat2gray([-3 -2 -1]), [0 0.5 1]);
before this fix the result is [1 0.5 1]
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47516>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #47516] image package: mat2gray rounding errorrs when rescaling,
Avinoam Kalma <=