File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ %% Histogram-based global thresholding
2
+ % Elen, A. & Dönmez, E., Histogram-based global thresholding method for
3
+ % image binarization, Optik, vol. 306, pp. 1-20 (2024).
4
+ % https://doi.org/10.1016/j.ijleo.2024.171814
5
+ % -------------------------------------------------------------------------
6
+
7
+ clc ;
8
+ clear ;
9
+ close all ;
10
+
11
+ %% Section 1: Get image.
12
+ % Set full path to the image.
13
+ imgFile = ' Images\Test.gif' ;
14
+ % Read image data.
15
+ img = imread(imgFile );
16
+ % Convert RGB image to grayscale, if need.
17
+ if (imfinfo(imgFile ).BitDepth > 8 )
18
+ img = rgb2gray(img );
19
+ end
20
+
21
+ %% Section 2: Run method.
22
+ thresholdElen = ElenThreshold(img );
23
+
24
+ % Binarize the image by threshold value.
25
+ binImg = imbinarize(img , thresholdElen / 256.0 );
26
+
27
+
28
+ %% Section 3: Show result.
29
+ fig = figure();
30
+ sgtitle(' Elen'' s Thresholding Method.' );
31
+
32
+ subplot(1 , 2 , 1 );
33
+ imshow(img );
34
+ title(' Input Image' );
35
+
36
+ subplot(1 , 2 , 2 );
37
+ imshow(binImg );
38
+ title(' Output Image' );
39
+
You can’t perform that action at this time.
0 commit comments