+
+function B = blkproc(A, varargin)
+ if(nargin<3)
+ error("blkproc: invalid number of parameters.");
+ endif
+
+ ## check 'indexed' presence
+ indexed=false;
+ p=1;
+ if(ischar(varargin{1}) && strcmp(varargin{1}, "indexed"))
+ indexed=true;
+ p+=1;
+ if(isa(A,"uint8") || isa(A,"uint16"))
+ padval=0;
+ else
+ padval=1;
+ endif
+ else
+ padval=0;
+ endif
+
+ ## check [m,n]
+ if(!isvector(varargin{p}))
+ error("blkproc: expected [m,n] but param is not a vector.");
+ endif
+ if(length(varargin{p})!=2)
+ error("blkproc: expected [m,n] but param has wrong length.");
+ endif
+ sblk=varargin{p}(:);
+ p+=1;
+
+ ## check [mborder,nborder]
+ if(nargin ischar
+%
+% Revision 1.4 2004/11/15 16:04:20 pkienzle
+% Fix tests for functions which return boolean matrices
+%
+% Revision 1.3 2004/09/03 17:49:37 jmones
+% Improved uint8 and uint16 padding expections
+%
+% Revision 1.2 2004/09/03 13:40:13 jmones
+% Check result has same class as function result, and improved fun param checking
+%
+% Revision 1.1 2004/08/15 19:27:46 jmones
+% blkproc: block process an image using user-supplied function
+%
+%