Image Processing Toolbox | ![]() ![]() |
The Image Processing Toolbox contains several functions called function functions, so named because they enable you to supply one of your own functions as an input argument. For example, blkproc
enables you to input your own block processing function, and qtdecomp
enables you to input your own algorithm for defining a criterion of homogeneity. This section shows you the different ways in which you can input your own function to a function function.
Note
As you may know, MATLAB has a directory named funfun containing function functions. However, the function functions of the Image Processing Toolbox are not included in this directory. For a discussion of the MATLAB functions in funfun , see the section in the MATLAB documentation entitled Function Functions." |
There are three different methods for passing your own function to a function function:
This appendix contains three examples -- one to demonstrate each method.
Note
Function handles are a new class in MATLAB 6.0. One advantage to
using them is that you can call a function function with a function handle to a
private function or subfunction. In previous versions of MATLAB, your
function had to be on the MATLAB path. For more information, see
function_handle in the MATLAB Function Reference.
|
All three examples use the function function blkproc
. The following blkproc
syntax variation is used.
B = BLKPROC(A,[m n],fun,P1,P2,...)
This syntax takes as its arguments an image A
, a block size [m n]
used to divide the image, and a function fun
, which is used to process each block. This syntax also takes any number of parameters (P1
, P2
, etc.) that may be needed by fun
.
All three examples use the same simple function to alter the brightness of a grayscale image.
represents a block of size
[m n]
, and can take any value. Note that this function was chosen because it works well for illustrative purposes; if you really want to brighten an image, you should use the
imadjust
function.
![]() | zoom | Passing an M-File Function to a Function Function | ![]() |