View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Remove ghosts from binarized images

5.0 | 1 rating Rate this file 13 Downloads (last 30 days) File Size: 56.9 KB File ID: #41786 Version: 1.1
image thumbnail

Remove ghosts from binarized images


Jan Motl (view profile)


17 May 2013 (Updated )

This method removes speckles in the binarized images.

| Watch this File

File Information

The postprocessing step used in Yanowitz and Bruckstein's binarization method removes "ghost" objects, and can be incorporated into other methods as well. The average gradient value at the edge of each printed object is calculated. Objects having an average gradient below a threshold TP are labeled as misclassified, and are removed. The main steps of the algorithm are given below:
 1. Smooth the original image by a (3x3) mean filter to remove noise.
 2. Calculate the gradient magnitude image G of the smoothed image, using, e.g., Sobel's edge operator.
 3. Select a value for TP.
 4. For all 4-connected print components, calculate the average gradient of the edge pixels. Edge pixels are print pixels that are 4-connected to the background. Remove print components having an average edge gradient below the threshold TP.
Øivind Due Trier , Torfinn Taxt. Evaluation of Binarization Methods for Document Images (1995). Available at:

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
15 Jan 2015 sara

sara (view profile)

good job

thanks a lot for sharing.

01 Apr 2014 Jan Motl

Jan Motl (view profile)

Thanks for reporting. I have added the missing example image. Let me know if you have more issues.

Comment only
01 Apr 2014 jacky chen

where is the demo image ?

Comment only
01 Apr 2014 1.1

Added example image.

Contact us