changeset 847:623e9454c77c

im2bw: set default value for threshold
author Carnë Draug <carandraug@octave.org>
date Tue, 31 Dec 2013 05:39:50 +0000
parents 00f512825eed
children fece5a7e933b
files inst/im2bw.m
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/inst/im2bw.m
+++ b/inst/im2bw.m
@@ -15,8 +15,8 @@
 ## this program; if not, see <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {@var{BW} =} im2bw (@var{img}, threshold)
-## @deftypefnx {Function File} {@var{BW} =} im2bw (@var{X}, @var{cmap}, threshold)
+## @deftypefn  {Function File} {} im2bw (@var{img}, threshold)
+## @deftypefnx {Function File} {} im2bw (@var{X}, @var{cmap}, threshold)
 ## Convert image to binary, black and white, by threshold.
 ##
 ## The input image @var{img} can either be a grayscale or RGB image.  In the later
@@ -38,14 +38,14 @@
 ## @seealso{graythresh, ind2gray, rgb2gray}
 ## @end deftypefn
 
-function BW = im2bw (img, cmap, thres)
+function BW = im2bw (img, cmap, thres = 0.5)
 
   if (nargin < 1 || nargin > 3)
     print_usage ();
   elseif (nargin == 3 && ! isind (img))
-    error ("im2bw: there must be only two arguments for non indexed images");
+    error ("im2bw: IMG must be an indexed image when are 3 input arguments");
   elseif (nargin == 3 && ! iscolormap (cmap))
-    error ("im2bw: CMAP must be the a colormap for indexed images");
+    error ("im2bw: CMAP must be a colormap");
   elseif (nargin == 2)
     thres = cmap;
   endif