Code covered by the BSD License  

Highlights from
Bernsen local image thresholding

2.5

2.5 | 2 ratings Rate this file 36 Downloads (last 30 days) File Size: 258 KB File ID: #40856
image thumbnail

Bernsen local image thresholding

by

 

18 Mar 2013 (Updated )

Implementation of Bernsen's thresholding method.

| Watch this File

File Information
Description

The method uses a user-provided contrast threshold. If the local contrast (max-min) is above or equal to the contrast threshold, the threshold is set at the local midgrey value (the mean of the minimum and maximum grey values in the local window). If the local contrast is below the contrast threshold the neighbourhood is considered to consist only of one class and the pixel is set to object or background depending on the value of the midgrey.

MATLAB release MATLAB 6.5 (R13)
MATLAB Search Path
/
/bernsen
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
24 Oct 2014 Jan Motl

I have retested Bersen thresholding on several operating systems and versions of MATLAB. In all configurations it worked.

But keep in mind that only 2-dimensinal matrices in uint8 are supported. However, if you load a jpg file with imread command then you get a 3-dimensional uint8 matrix (even if the image is grayscale). Hence you have reduce dimensionality.

Also, it is generally advisable to test several sizes of the neighborhood to get good results.

For example, to get the illustration image from the attached jpg, use following command:
imshow(bernsen(rgb2gray(imread('image.jpg')), [93, 93]));

The description of the algorithm (and the parameters) is for example at:
http://fiji.sc/wiki/index.php/Auto_Local_Threshold#Bernsen

If you are still having difficulties with the code, let me know more details (like version of MATALB, OS, example image, the minimal code reproducing the error,...) and I will do my best to help you.

23 Oct 2014 Rohan Ghare

not working proper
what are different parameters of bernsen

24 Jun 2013 thong  
Updates
24 Oct 2014

Extended help text.

Contact us