Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahelen authored Apr 22, 2024
1 parent c31f269 commit a69b967
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions BasicSample.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%% Histogram-based global thresholding
% Elen, A. & Dönmez, E., Histogram-based global thresholding method for
% image binarization, Optik, vol. 306, pp. 1-20 (2024).
% https://doi.org/10.1016/j.ijleo.2024.171814
% -------------------------------------------------------------------------

clc;
clear;
close all;

%% Section 1: Get image.
% Set full path to the image.
imgFile = 'Images\Test.gif';
% Read image data.
img = imread(imgFile);
% Convert RGB image to grayscale, if need.
if (imfinfo(imgFile).BitDepth > 8)
img = rgb2gray(img);
end

%% Section 2: Run method.
thresholdElen = ElenThreshold(img);

% Binarize the image by threshold value.
binImg = imbinarize(img, thresholdElen / 256.0);


%% Section 3: Show result.
fig = figure();
sgtitle('Elen''s Thresholding Method.');

subplot(1, 2, 1);
imshow(img);
title('Input Image');

subplot(1, 2, 2);
imshow(binImg);
title('Output Image');

0 comments on commit a69b967

Please sign in to comment.