From: <car...@us...> - 2012-03-15 12:43:20
|
Revision: 9903 http://octave.svn.sourceforge.net/octave/?rev=9903&view=rev Author: carandraug Date: 2012-03-15 12:43:09 +0000 (Thu, 15 Mar 2012) Log Message: ----------- iscolormap: new function to image package Modified Paths: -------------- trunk/octave-forge/main/image/NEWS Added Paths: ----------- trunk/octave-forge/main/image/inst/iscolormap.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-03-15 02:49:14 UTC (rev 9902) +++ trunk/octave-forge/main/image/NEWS 2012-03-15 12:43:09 UTC (rev 9903) @@ -18,6 +18,7 @@ iptchecknargin iptcheckstrs iptnum2ordinal + iscolormap normxcorr2 wavelength2rgb Added: trunk/octave-forge/main/image/inst/iscolormap.m =================================================================== --- trunk/octave-forge/main/image/inst/iscolormap.m (rev 0) +++ trunk/octave-forge/main/image/inst/iscolormap.m 2012-03-15 12:43:09 UTC (rev 9903) @@ -0,0 +1,39 @@ +## 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/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} iscolormap (@var{cm}) +## Return true if @var{cm} is a colormap. +## +## A colormap is an @var{n} row by 3 column matrix. The columns contain red, +## green, and blue intensities respectively. All entries should be between 0 +## and 1 inclusive. +## +## @seealso{colormap} +## @end deftypefn + +function bool = iscolormap (cm) + + if (nargin != 1) + print_usage; + endif + + bool = false; + if (ismatrix (cm) && isnumeric (cm) && columns(cm) == 3 && + min (cm(:)) >= 0 && max (cm(:)) <= 1) + bool = true; + endif + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |