From: <car...@us...> - 2012-09-02 03:41:46
|
Revision: 10949 http://octave.svn.sourceforge.net/octave/?rev=10949&view=rev Author: carandraug Date: 2012-09-02 03:41:40 +0000 (Sun, 02 Sep 2012) Log Message: ----------- is_double_image: new private function to check if an image of class double is valid Modified Paths: -------------- trunk/octave-forge/main/image/inst/isgray.m trunk/octave-forge/main/image/inst/isrgb.m Added Paths: ----------- trunk/octave-forge/main/image/inst/private/is_double_image.m Modified: trunk/octave-forge/main/image/inst/isgray.m =================================================================== --- trunk/octave-forge/main/image/inst/isgray.m 2012-09-02 03:33:55 UTC (rev 10948) +++ trunk/octave-forge/main/image/inst/isgray.m 2012-09-02 03:41:40 UTC (rev 10949) @@ -43,7 +43,7 @@ elseif (ndims (img) == 2) switch (class (img)) case "double" - bool = ispart (@is_gray_double, img); + bool = ispart (@is_double_image, img); case {"uint8", "uint16"} bool = true; endswitch @@ -51,10 +51,6 @@ endfunction -function bool = is_gray_double (img) - bool = all ((img(:) >= 0 & img(:) <= 1) | isnan (img(:))); -endfunction - %!shared a %! a = rand (100); %!assert (isgray (a), true); Modified: trunk/octave-forge/main/image/inst/isrgb.m =================================================================== --- trunk/octave-forge/main/image/inst/isrgb.m 2012-09-02 03:33:55 UTC (rev 10948) +++ trunk/octave-forge/main/image/inst/isrgb.m 2012-09-02 03:41:40 UTC (rev 10949) @@ -44,7 +44,7 @@ elseif (ndims (img) == 3 && size (img, 3) == 3) switch (class (img)) case "double" - bool = ispart (@is_rgb_double, img); + bool = ispart (@is_double_image, img); case {"uint8", "uint16"} bool = true; endswitch @@ -52,10 +52,6 @@ endfunction -function bool = is_rgb_double (img) - bool = all ((img(:) >= 0 & img(:) <= 1) | isnan (img(:))); -endfunction - %!# Non-matrix %!assert(isrgb("this is not a RGB image"),false); Added: trunk/octave-forge/main/image/inst/private/is_double_image.m =================================================================== --- trunk/octave-forge/main/image/inst/private/is_double_image.m (rev 0) +++ trunk/octave-forge/main/image/inst/private/is_double_image.m 2012-09-02 03:41:40 UTC (rev 10949) @@ -0,0 +1,21 @@ +## Copyright (C) 2012 Carnë Draug <car...@gm...> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see <http://www.gnu.org/licenses/>. + +## simple check used by some functions. Images of the double class must have +## all their values between 0 and 1 or be NaN + +function bool = is_double_image (img) + bool = all ((img(:) >= 0 & img(:) <= 1) | isnan (img(:))); +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |