Mercurial > forge
changeset 10950:67d1aa7ea4ce octave-forge
im2bw: threshold should be greater than only (matlab compatible)
author | carandraug |
---|---|
date | Wed, 26 Sep 2012 08:08:21 +0000 |
parents | 80e6dc3f2ad9 |
children | 982dab0635cd |
files | main/image/NEWS main/image/inst/im2bw.m |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/main/image/NEWS Wed Sep 26 08:07:49 2012 +0000 +++ b/main/image/NEWS Wed Sep 26 08:08:21 2012 +0000 @@ -74,6 +74,8 @@ ** `im2bw' now supports input images of the int16 class and deals better with RGB images since it uses `rgb2gray' internally (see changes to rgb2gray). + Threshold is performed on all values greater than value instead of greater + than or equal. ** `imhist' is much more compatible with matlab and among other changes, it now uses the whole range of the class for the histogram rather than
--- a/main/image/inst/im2bw.m Wed Sep 26 08:07:49 2012 +0000 +++ b/main/image/inst/im2bw.m Wed Sep 26 08:08:21 2012 +0000 @@ -81,8 +81,8 @@ error("im2bw: unsupported image class"); endswitch - BW = (img >= thres); + BW = (img > thres); # matlab compatible (not "greater than or equal") endfunction -%!assert(im2bw ([0 0.5 1], 0.5), [0 1 1]); # basic usage -%!assert(im2bw (uint8 ([0 120 255], 0.5)), [0 0 1]); # with a uint8 input +%!assert(im2bw ([0 0.4 0.5 0.6 1], 0.5), [0 0 0 1 1]); # basic usage +%!assert(im2bw (uint8 ([0 100 255], 0.5)), [0 0 1]); # with a uint8 input