# HG changeset patch # User Avinoam # Date 1439762698 -10800 # Mon Aug 17 01:04:58 2015 +0300 # Node ID 1bedc45745c1a244c5e0dab2adb892a948812714 # Parent b4a7b1e1daadba1c6e4996049464b740dc5cb921 imadjust: use more classes, not only double (bug #42115) * imadjust.m: transform the original image to double, and the final result back to the original class diff -r b4a7b1e1daad -r 1bedc45745c1 inst/imadjust.m --- a/inst/imadjust.m Tue Aug 11 01:01:38 2015 +0100 +++ b/inst/imadjust.m Mon Aug 17 01:04:58 2015 +0300 @@ -113,6 +113,11 @@ in=[0;1]; ## default in endif + classI = class (image); + if (!strcmp (classI, 'double')) + image = imcast (image, 'double'); + endif + if (isempty (out)) out=[0;1]; ## default out endif @@ -153,6 +158,10 @@ else error("imadjust: first parameter must be a colormap, an intensity image or a RGB image"); endif + + if (!strcmp (classI, 'double')) + ret = imcast (ret, classI); + endif endfunction ## This does all the work. I has a plane; li and hi input low and high