changeset 435:8b58472d87e8

Allow non-double images when using Fourier rotations
author hauberg
date Mon, 18 Oct 2010 10:49:30 +0000
parents 8e084620fe5b
children f3e55bdcd78e
files inst/imrotate.m
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/inst/imrotate.m
+++ b/inst/imrotate.m
@@ -152,6 +152,8 @@
 
   ## Now the actual rotations happen
   if (strcmpi(interp, "Fourier"))
+    c = class (imgPre);
+    imgPre = im2double (imgPre);
     if (isgray(imgPre))
       imgPost = imrotate_Fourier(imgPre, thetaDeg, interp, bbox);
     else # rgb image
@@ -160,6 +162,15 @@
       endfor
     endif
     valid = NA;
+    
+    switch (c)
+      case "uint8"
+        imgPost = im2uint8 (imgPost);
+      case "uint16"
+        imgPost = im2uint16 (imgPost);
+      case "single"
+        imgPost = single (imgPost);
+    endswitch
   else
     [imgPost, valid] = imperspectivewarp(imgPre, H, interp, bbox, extrapval);
   endif