Health Check: The healthy App
- dov azogui
- 11 oct. 2023
- 5 min de lecture

In the realm of engineering and software development, the ability to bridge the gap between complex computations and user-friendly applications is paramount. "Health Check" stands as a testament to this philosophy.
Technical Highlights:
MATLAB Development: The core of Health Check was developed using MATLAB, a high-performance language for technical computing. This allowed us to harness its powerful mathematical libraries and data visualization tools, ensuring the app's analytical precision.
Image Processing: One of the major challenges was to accurately interpret scanned images of food items. We employed MATLAB's Image Processing Toolbox, which facilitated the extraction of relevant features from the images, enabling the app to recognize and categorize various food items.
Database Integration: To provide users with detailed nutritional information, we integrated a comprehensive food database. This required meticulous data structuring and efficient querying methods to ensure real-time feedback upon scanning.
Algorithm Optimization: The success of Health Check hinges on its speed and accuracy. We spent considerable time refining our algorithms, ensuring they are both efficient in terms of computational time and accurate in their output.
User Interface Design: While MATLAB might not be the conventional choice for app development, we leveraged its GUI development tools to create an interface that is both intuitive and informative, ensuring users can easily navigate and extract value from the app.
In developing Health Check, our goal was not just to create a functional tool but to showcase the versatility of MATLAB in real-world applications. The project underscores our commitment to technical excellence and our ability to transform intricate engineering concepts into tangible solutions.
here is the Matlab code of this project:
classdef Healthcheck < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
pressheretostartLabel matlab.ui.control.Label
HEALTHCHECKAPPLabel matlab.ui.control.Label
ItishealthyLabel matlab.ui.control.Label
NutritionalfactsheetLabel matlab.ui.control.Label
TakeapictureButton matlab.ui.control.Button
FoodidentifiedLabel matlab.ui.control.Label
UIAxes matlab.ui.control.UIAxes
end
properties (Access = private)
Property % Description
vidObj;
net ;
inputSize ;
newimg ;
CName ;
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.net = googlenet;
app.inputSize = app.net.Layers(1).InputSize;
app.vidObj = videoinput('macvideo');
preview(app.vidObj);
end
% Button pushed function: TakeapictureButton
function TakeapictureButtonPushed(app, event)
img = getsnapshot(app.vidObj);
img = ycbcr2rgb(img);
image(img, 'Parent', app.UIAxes);
app.newimg = imresize(img,app.inputSize(1:2));
app.CName = classify(app.net,app.newimg);
app.FoodidentifiedLabel.Text = app.CName;
CName0 = char(app.CName);
if strcmp(CName0,'banana')
app.NutritionalfactsheetLabel.Text=['caloric intake 90 kcal for 100 g ' ...
'- 75.80 g Water ' ...
'- 19.70 g Carbohydrates ' ...
'- 2.70 g Fibres ' ...
'- 0.36 mg Manganese ' ...
'- 320 mg Potassium'];
end
if strcmp(CName0,'banana')
app.ItishealthyLabel.Text=('Healthy');
end
if strcmp(CName0,'pineapple')
app.NutritionalfactsheetLabel.Text=['Caloric intake 54 kcal per 100 g ' ...
'- 85.50 g Water -' ...
'11.70 g Carbohydrates - ' ...
'1.20 g Fibres ' ...
'- 46.10 mg Vitamin C ' ...
'- 0.84 mg Manganeseum'];
end
if strcmp(CName0,'pineapple')
app.ItishealthyLabel.Text=('Healthy');
end
if strcmp(CName0,'strawberry')
app.NutritionalfactsheetLabel.Text=['caloric intake 38 kcal for 100 g ' ...
'- 90.30 g Water ' ...
'- 6.03 g Carbohydrates ' ...
'- 3.80 g Fibres ' ...
'- 54 mg Vitamin C ' ...
'- 98.90 µg Vitamin B9'];
end
if strcmp(CName0,'strawberry')
app.ItishealthyLabel.Text=('Healthy');
end
if strcmp(CName0,'orange')
app.NutritionalfactsheetLabel.Text=['caloric intake 45 kcal for 100 g ' ...
'- 87.30 g Water ' ...
'- 8.03 g Carbohydrates ' ...
'- 2.70 g Fibres ' ...
'- 47.50 mg Vitamin C ' ...
'- 25.90 µg Vitamin B9'];
end
if strcmp(CName0,'orange')
app.ItishealthyLabel.Text=('Healthy');
end
if strcmp(CName0,'lemon')
app.NutritionalfactsheetLabel.Text=['caloric intake 27 kcal for 100 g ' ...
'- 91.30 g Water ' ...
'- 1.56 g Carbohydrates ' ...
'- <0.50 g Fibres ' ...
'- 45 mg Vitamin C ' ...
'- 28.40 µg Vitamin B9'];
end
if strcmp(CName0,'lemon')
app.ItishealthyLabel.Text=('Healthy');
end
if strcmp(CName0,'fig')
app.NutritionalfactsheetLabel.Text=['caloric intake 69 kcal for 100 g ' ...
'- 80.20 g Water ' ...
'- 13.50 g Carbohydrates ' ...
'- 4.10 g Fibres ' ...
'- 24.50 µg Vitamin B9 ' ...
'- 230 mg Potassium'];
end
if strcmp(CName0,'fig')
app.ItishealthyLabel.Text=('Healthy');
end
if strcmp(CName0,'pizza')
app.NutritionalfactsheetLabel.Text=['FOR 100 g : caloric intake 230 kcal ' ...
'- 9.0 g Protein ' ...
'- 50 g Water ' ...
'- 26.2 g Carbohydrates ' ...
'- 10.0 g Fat '];
end
if strcmp(CName0,'pizza')
app.ItishealthyLabel.Text=('Not Healthy');
end
if strcmp(CName0,'guacamole')
app.NutritionalfactsheetLabel.Text=['FOR 100 g : caloric intake 180 kcal ' ...
'- 2.0 g Protein ' ...
'- 72 g Water ' ...
'- 4.6 g Carbohydrates ' ...
'- 16.6 g Fat '];
end
if strcmp(CName0,'guacamole')
app.ItishealthyLabel.Text=('With moderation');
end
if strcmp(CName0,'ice cream')
app.NutritionalfactsheetLabel.Text=['FOR 100 g : caloric intake 278 kcal ' ...
'- 4.2 g Protein ' ...
'- 47 g Water ' ...
'- 33.1 g Carbohydrates ' ...
'- 14.2 g Fat '];
end
if strcmp(CName0,'ice cream')
app.ItishealthyLabel.Text=('Not healthy');
end
if strcmp(CName0,'cheeseburger')
app.NutritionalfactsheetLabel.Text=['FOR 100 g : caloric intake 262 kcal ' ...
'- 13.7 g Protein ' ...
'- 46 g Water ' ...
'- 25.4 g Carbohydrates ' ...
'- 11.5 g Fat '];
end
if strcmp(CName0,'cheeseburger')
app.ItishealthyLabel.Text=('Not healthy');
end
if strcmp(CName0,'mashed potato')
app.NutritionalfactsheetLabel.Text=['FOR 100 g : caloric intake 91 kcal ' ...
'- 2 g Protein ' ...
'- 79 g Water ' ...
'- 12.6 g Carbohydrates ' ...
'- 3.4 g Fat '];
end
if strcmp(CName0,'mashed potato')
app.ItishealthyLabel.Text=('Healthy');
end
system(sprintf('say %s', CName0));
system(sprintf('say %s', app.ItishealthyLabel.Text));
end
% Callback function
function ImageClicked(app, event)
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Color = [0.549 0.7412 0.302];
app.UIFigure.Position = [100 100 607 495];
app.UIFigure.Name = 'MATLAB App';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, {'Picture of the aliment'; ''})
app.UIAxes.XTick = [];
app.UIAxes.YTick = [];
app.UIAxes.FontSize = 14;
app.UIAxes.Position = [122 204 367 204];
% Create FoodidentifiedLabel
app.FoodidentifiedLabel = uilabel(app.UIFigure);
app.FoodidentifiedLabel.BackgroundColor = [1 1 0];
app.FoodidentifiedLabel.HorizontalAlignment = 'center';
app.FoodidentifiedLabel.FontName = 'Impact';
app.FoodidentifiedLabel.FontSize = 20;
app.FoodidentifiedLabel.FontAngle = 'italic';
app.FoodidentifiedLabel.Position = [250 179 128 26];
app.FoodidentifiedLabel.Text = 'Food identified';
% Create TakeapictureButton
app.TakeapictureButton = uibutton(app.UIFigure, 'push');
app.TakeapictureButton.ButtonPushedFcn = createCallbackFcn(app, @TakeapictureButtonPushed, true);
app.TakeapictureButton.BackgroundColor = [1 1 0];
app.TakeapictureButton.FontSize = 18;
app.TakeapictureButton.FontWeight = 'bold';
app.TakeapictureButton.Position = [238 423 136 32];
app.TakeapictureButton.Text = 'Take a picture';
% Create NutritionalfactsheetLabel
app.NutritionalfactsheetLabel = uilabel(app.UIFigure);
app.NutritionalfactsheetLabel.BackgroundColor = [1 1 0];
app.NutritionalfactsheetLabel.HorizontalAlignment = 'center';
app.NutritionalfactsheetLabel.WordWrap = 'on';
app.NutritionalfactsheetLabel.FontName = 'Courier';
app.NutritionalfactsheetLabel.FontSize = 14;
app.NutritionalfactsheetLabel.Position = [83 96 465 71];
app.NutritionalfactsheetLabel.Text = 'Nutritional factsheet';
% Create ItishealthyLabel
app.ItishealthyLabel = uilabel(app.UIFigure);
app.ItishealthyLabel.BackgroundColor = [1 1 0];
app.ItishealthyLabel.HorizontalAlignment = 'center';
app.ItishealthyLabel.FontSize = 18;
app.ItishealthyLabel.Position = [259 46 112 23];
app.ItishealthyLabel.Text = 'It is healthy ?';
% Create HEALTHCHECKAPPLabel
app.HEALTHCHECKAPPLabel = uilabel(app.UIFigure);
app.HEALTHCHECKAPPLabel.BackgroundColor = [0.4667 0.6745 0.1882];
app.HEALTHCHECKAPPLabel.FontSize = 18;
app.HEALTHCHECKAPPLabel.FontColor = [1 1 0];
app.HEALTHCHECKAPPLabel.Position = [217 473 180 23];
app.HEALTHCHECKAPPLabel.Text = 'HEALTH CHECK APP';
% Create pressheretostartLabel
app.pressheretostartLabel = uilabel(app.UIFigure);
app.pressheretostartLabel.FontName = 'Monospaced';
app.pressheretostartLabel.FontSize = 16;
app.pressheretostartLabel.FontWeight = 'bold';
app.pressheretostartLabel.FontAngle = 'italic';
app.pressheretostartLabel.Position = [38 428 208 22];
app.pressheretostartLabel.Text = 'press here to start->';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = Healthcheck
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end






