|Image Processing Toolbox User's Guide|
2. Estimate the Value of Background Pixels
In the sample image, the background illumination is brighter in the center of the image than at the bottom. In this step, the example uses a morphological opening operation to estimate the background illumination. Morphological opening is an erosion followed by a dilation, using the same structuring element for both operations. The opening operation has the effect of removing objects that cannot completely contain the structuring element. For more information about morphological image processing, see Morphological Operations.
The example calls the
imopen function to perform the morphological opening operation. Note how the example calls the
strel function to create a disk-shaped structuring element with a radius of 15. To remove the rice grains from the image, the structuring element must be large enough so that it cannot fit entirely inside a single grain of rice.
To see the estimated background image, type
|1. Read and Display an Image||3. View the Background Approximation as a Surface|
© 1994-2005 The MathWorks, Inc.