changeset 10003:2a5e2eb5a95d octave-forge

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 ca662c5d8038
children ebea8994debd
files main/image/NEWS main/image/inst/im2double.m
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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"