Académique Documents
Professionnel Documents
Culture Documents
Engr. Valiente, E.
Instructor
I. Introduction
Digital image processing is an application of many different field of studies, namely
electronics, electric, and computer engineering. Its use widely ranges from changing
the filter of your photo for Instagram, up to climate detection, face recognition, etc…
It is being used daily around the world and had become an integral part of the today’s
modern and sophisticated living.
MATLAB is only one of many integrated development environment (IDE) available
on the market. Digital image processing is taking a image file (in jpg, jpeg, png, bmp,
etc…) and perform image processes to extract meaningful information from the image
using the available functions on an IDE. Different IDEs uses different algorithms to
solve different kind of problems.
II. Acknowledgement
I would like to express my gratitude to our very instructor, Engr. Leonardo Valiente
for being the light for us in learning about the different signal simulations, filters, and
techniques on MATLAB, because not every student is fluent in this programming
language.
I would also like to thank the different youtube channels; MATLAB,
pantechsolutions, for introducing me the tools I need to enhance the effectivity of the
project I created.
III. Program Description
The program can do two basic techniques of digital image processing: image
enhancement and image segmentation. The user can upload their image file by
clicking the Choose and Image button.
On the Enhancement Tab, the image will undergo the process of Deep Correlation
Stretch to enhance a poorly contrasted image. Adjusting the brightness is also
available, from pitch black up to brightest white. On the left of the processed image
is the histogram and the 3D scatter plot of the product image. (Samples on Section V)
On the Segmentation Tab, the image will be separated by 3 planes, namely the
red, green, and blue plane. By this, the image can be segmented more specifically,
depending on the user. The holes created by the sum of the red, green, and blue plane
will be morphologically processed, and the final product image will be shown.
This program only uses the most basic enhancement and segmentation
techniques; it is not designed for any specific uses. This program was only created to
demonstrate the course requirements in digital image processing using MATLAB as
the integrated development environment. Although, the sample pictures presented
could be converted into meaningful data.
V. Screen Capture of Images
VI. M-File
plot3(app.Axes3DPlot,r(:),g(:),b(:), segim =
'.'); imcomplement(im);
rmat = segim(:,:,1);
grid(app.Axes3DPlot, "on"); gmat = segim(:,:,2);
bmat = segim(:,:,3);
histim =
histogram(app.AxesHistogram, ir =
decor_im(:,:,1)); imbinarize(rmat,levelr);
maxg = imagesc(app.AxesRed,
max(histim.BinCounts); ir);
ig =
app.AxesHistogram.YLim = [0 maxg]; imbinarize(gmat,levelg);
imagesc(app.AxesGreen,
app.AxesHistogram.YTick = round([0 ig);
maxg/2 maxg], 2, 'significant'); ib =
% catch ME imbinarize(bmat,levelb);
% If problem imagesc(app.AxesBlue,
reading image, display error message ib);
%
uialert(app.DSP_LAB, ME.message, if(not(boolr))
'Image Error'); ir = 1;
% return; end
% end if(not(boolg))
end ig = 1;
end
if(not(boolb))
function segmentimage(app, ib = 1;
filename) end
im = imread(filename);
levelr = itotal = (ir&ig&ib);
get(app.SliderRed,'value'); ifilled = imfill(itotal,
levelg = 'holes');
get(app.SliderGreen,'value'); if(booldisk)
se = end
strel('disk',rad);
else % Callback function
se = function
strel('square',width); ProcessButtonGroupSelectionChanged(a
end pp, event)
iop = selectedButton =
imopen(ifilled,se); app.ProcessButtonGroup.SelectedObjec
t;
imagesc(app.AxesSegment, im =
iop); imread(app.FilenameLabel.Text);
imagesc(app.AxesEnhance,im);
end
end switch selectedButton
case
app.ImageEnhancementButton
% Callbacks that handle app.AxesHistogram.Visible = 'on';
component events r = im(:,:,1);
methods (Access = private) b = im(:,:,2);
g = im(:,:,3);
% Code that executes after
component creation plot3(app.Axes3DPlot,r(:),g(:),b(:),
function startupFcn(app) '.');
app.AxesImage.Colormap =
gray(256); grid(app.Axes3DPlot, "on");
axis(app.AxesImage,
'image'); histim =
histogram(app.AxesHistogram,
im(:,:,1));
end maxg =
max(histim.BinCounts);
% Button pushed function:
ChooseanImageButton app.AxesHistogram.YLim = [0 maxg];
function
ChooseanImageButtonPushed(app, app.AxesHistogram.YTick = round([0
event) maxg/2 maxg], 2, 'significant');
filterspec =
{'*.jpg;*.tif;*.png;*.gif','All end
Image Files'}; end
[f, p] =
uigetfile(filterspec); % Value changed function:
SliderDeepCorr
if (ischar(p)) function
fname = [p f]; SliderDeepCorrValueChanged(app,
event)
app.FilenameLabel.Text = fname; value =
im = imread(fname); app.SliderDeepCorr.Value;
fname =
imagesc(app.AxesImage,im); app.FilenameLabel.Text;
enhanceimage(app, enhanceimage(app,
fname); fname);
segmentimage(app, labelvalue =
fname); num2str(value);
end
app.LabelVal.Text = value =
labelvalue; app.SliderBlue.Value;
end fname =
app.FilenameLabel.Text;
% Value changed function: segmentimage(app,
BrightnessSlider fname);
function end
BrightnessSliderValueChanged(app,
event) % Value changed function:
value = TextEditRadius
app.BrightnessSlider.Value; function
fname = TextEditRadiusValueChanged(app,
app.FilenameLabel.Text; event)
enhanceimage(app, value =
fname); app.TextEditRadius.Value;
end fname =
app.FilenameLabel.Text;
% Callback function segmentimage(app,
function fname);
SaveImageButtonPushed(app, event) end
out_image =
imread('eeee.jpg'); % Value changed function:
imwrite(out_image, CheckRed
'EnhancedImage.jpg'); function
end CheckRedValueChanged(app, event)
value =
% Value changed function: app.CheckRed.Value;
SliderRed fname =
function app.FilenameLabel.Text;
SliderRedValueChanged(app, event) segmentimage(app,
value = fname);
app.SliderRed.Value; end
fname =
app.FilenameLabel.Text; % Value changed function:
segmentimage(app, CheckGreen
fname); function
end CheckGreenValueChanged(app, event)
value =
% Value changed function: app.CheckGreen.Value;
SliderGreen fname =
function app.FilenameLabel.Text;
SliderGreenValueChanged(app, event) segmentimage(app,
value = fname);
app.SliderGreen.Value; end
fname =
app.FilenameLabel.Text; % Value changed function:
segmentimage(app, CheckBlue
fname); function
CheckBlueValueChanged(app, event)
end value =
app.CheckBlue.Value;
% Value changed function: fname =
SliderBlue app.FilenameLabel.Text;
function segmentimage(app,
SliderBlueValueChanged(app, event) fname);
end
0.5686 0.9373;0.1529 0.5922
% Selection changed 0.9216;0.1451 0.6078 0.9098;0.1373
function: FilterModesButtonGroup 0.6275 0.898;0.1255 0.6471
function 0.8902;0.1098 0.6627 0.8745;0.0941
FilterModesButtonGroupSelectionChang 0.6784 0.8588;0.0706 0.6941
ed(app, event) 0.8392;0.0314 0.7098 0.8157;0.0039
selectedButton = 0.7216 0.7922;0.0078 0.7294
app.FilterModesButtonGroup.SelectedO 0.7647;0.0431 0.7412 0.7412;0.098
bject; 0.749 0.7137;0.1412 0.7569
fname = 0.6824;0.1725 0.7686 0.6549;0.1922
app.FilenameLabel.Text; 0.7765 0.6235;0.2157 0.7843
segmentimage(app, 0.5922;0.2471 0.7922 0.5569;0.2902
fname); 0.7961 0.5176;0.3412 0.8
end 0.4784;0.3922 0.8039 0.4353;0.4471
0.8039 0.3922;0.5059 0.8
% Value changed function: 0.349;0.5608 0.7961 0.3059;0.6157
TextEditSquare 0.7882 0.2627;0.6706 0.7804
function 0.2235;0.7255 0.7686 0.1922;0.7725
TextEditSquareValueChanged(app, 0.7608 0.1647;0.8196 0.749
event) 0.1529;0.8627 0.7412 0.1608;0.902
value = 0.7333 0.1765;0.9412 0.7294
app.TextEditSquare.Value; 0.2118;0.9725 0.7294 0.2392;0.9961
fname = 0.7451 0.2353;0.9961 0.7647
app.FilenameLabel.Text; 0.2196;0.9961 0.7882 0.2039;0.9882
segmentimage(app, 0.8118 0.1882;0.9804 0.8392
fname); 0.1765;0.9686 0.8627 0.1647;0.9608
end 0.8902 0.1529;0.9608 0.9137
end 0.1412;0.9647 0.9373 0.1255;0.9686
0.9608 0.1059;0.9765 0.9843 0.0824];
app.DSP_LAB.Position =
% Component initialization [100 100 962 660];
methods (Access = private) app.DSP_LAB.Name = 'DSP
Laboratory Project';
% Create UIFigure and
components % Create AxesImage
function app.AxesImage =
createComponents(app) uiaxes(app.DSP_LAB);
title(app.AxesImage,
% Create DSP_LAB and 'Image')
hide until all components are xlabel(app.AxesImage,
created '')
app.DSP_LAB = ylabel(app.AxesImage,
uifigure('Visible', 'off'); '')
app.DSP_LAB.Colormap = app.AxesImage.XTick =
[0.2431 0.149 0.6588;0.251 0.1647 [];
0.7059;0.2588 0.1804 0.7529;0.2627 app.AxesImage.YTick =
0.1961 0.7961;0.2706 0.2157 [];
0.8353;0.2745 0.2353 0.8706;0.2784 app.AxesImage.Position =
0.2549 0.898;0.2784 0.2784 [20 400 308 239];
0.9216;0.2784 0.302 0.9412;0.2824
0.3216 0.9569;0.2784 0.3451 % Create
0.9725;0.2745 0.3686 0.9843;0.2706 ChooseanImageButton
0.3882 0.9922;0.2588 0.4118 app.ChooseanImageButton
0.9961;0.2431 0.4353 1;0.2196 0.4588 = uibutton(app.DSP_LAB, 'push');
0.9961;0.1961 0.4863 0.9882;0.1843
0.5059 0.9804;0.1804 0.5294 app.ChooseanImageButton.ButtonPushed
0.9686;0.1765 0.549 0.9529;0.1686
Fcn = createCallbackFcn(app,
@ChooseanImageButtonPushed, true); ylabel(app.AxesHistogram, 'Pixels')
app.LevelGreenPlaneLabel.Position = % Create
[23 219 127 22]; DiskRadiusEditFieldLabel
app.LevelGreenPlaneLabel.Text = app.DiskRadiusEditFieldLabel =
'Level(Green Plane)'; uilabel(app.SegmentationTab);
% Create SliderGreen
createCallbackFcn(app,
app.DiskRadiusEditFieldLabel.Horizon @CheckBlueValueChanged, true);
talAlignment = 'right'; app.CheckBlue.Text = '';
app.CheckBlue.Position =
app.DiskRadiusEditFieldLabel.Positio [14 116 25 22];
n = [102 44 70 22]; app.CheckBlue.Value =
true;
app.DiskRadiusEditFieldLabel.Text =
'Disk Radius'; % Create
FilterModesButtonGroup
% Create TextEditRadius
app.TextEditRadius = app.FilterModesButtonGroup =
uieditfield(app.SegmentationTab, uibuttongroup(app.SegmentationTab);
'text');
app.FilterModesButtonGroup.Selection
app.TextEditRadius.ValueChangedFcn = ChangedFcn = createCallbackFcn(app,
createCallbackFcn(app, @FilterModesButtonGroupSelectionChan
@TextEditRadiusValueChanged, true); ged, true);
app.GuanzingJacobChristianPECE107LE0 if nargout == 0
4Label.VerticalAlignment = 'top'; clear app
end
app.GuanzingJacobChristianPECE107LE0 end
4Label.FontSize = 21;
% Code that executes before
app.GuanzingJacobChristianPECE107LE0 app deletion
4Label.Position = [38 60 272 55]; function delete(app)