# HG changeset patch # User carandraug # Date 1334153307 0 # Node ID 2a5e2eb5a95d310af8aa806e2113d278448ebcf0 # Parent ca662c5d80380c0860c317115290261137b8ae6d im2double: added support for binary images (patch by Martin Helm ) diff -r ca662c5d8038 -r 2a5e2eb5a95d main/image/NEWS --- a/main/image/NEWS Wed Apr 11 13:34:25 2012 +0000 +++ b/main/image/NEWS Wed Apr 11 14:08:27 2012 +0000 @@ -43,6 +43,7 @@ bweuler imhist conndef + im2double isbw isgray isrgb diff -r ca662c5d8038 -r 2a5e2eb5a95d main/image/inst/im2double.m --- a/main/image/inst/im2double.m Wed Apr 11 13:34:25 2012 +0000 +++ b/main/image/inst/im2double.m Wed Apr 11 14:08:27 2012 +0000 @@ -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"