Image Processing Toolbox    

Appendix A

Working with Function Functions


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.

There are three different methods for passing your own function to a function function:

This appendix contains three examples -- one to demonstrate each method.

All three examples use the function function blkproc. The following blkproc syntax variation is used.

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