Mercurial > hg > octave-image
changeset 545:23a7bdae105c
im2double: added support for binary images (patch by Martin Helm <martin@mhelm.de>)
author | carandraug |
---|---|
date | Wed, 11 Apr 2012 14:08:27 +0000 |
parents | 5127beba4f52 |
children | 9b9d8d949d2d |
files | NEWS inst/im2double.m |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/inst/im2double.m +++ b/inst/im2double.m @@ -28,15 +28,16 @@ ## Input checking if (nargin < 1) print_usage(); - endif - if (!isgray(im1) && !isrgb(im1)) + elseif (!isgray(im1) && !isrgb(im1) && !isbw(im1)) error("im2double: input must be an image"); endif - + ## Take action depending on the class of the data switch (class(im1)) case "double" im2 = im1; + case "logical" + im2 = double(im1); case "uint8" im2 = double(im1) / 255; case "uint16"