PDD2
Final Year Project Report
Year 2011
PROJECT TITLE
Effect of Heat Treatment on Eye using
Thermogram: A Comprehensive Analysis
TEAM MEMBERS
10076200C CHAN WEI YAN
10076198A MUHAMMAD ZULFADLY B ABDUL M
10075607A ZAR LI WIN NAING
LOCATION
08-03-0004
SUPERVISOR
ACHARYA RAJENDRA UDYAVARA
Title Page:
Project title:
Team Members:
Project Group:
P602
Supervisor:
Affliation:
Contents
Acknowledgement
1 Abstract..................................................................................................Page 5
2 - Project Statement...................................................................................Page 6
3 - Project Objectives .................................................................................Page 6
4 - Background Information
4.1 Human eye: How our eyes see......................................................Page 7
4.2 Tear film.........................................................................................Page 8-9
4.3 Tears...............................................................................................Page 9
4.4 Dry Eye Syndrome.......................................................................Page 9-10
4.5 Meibomian Gland.....................................................................Page 10 -11
4.6 Heat Treatment...............................................................................Page 11
4.7 EyeGiene System..........................................................................Page 12
4.8 Infrared Imaging..............................................................................Page 13
5 Project Requirement................................................................................Page 14
Equipment Set-up...................................................................................Page 14
6 Experimental Procedure.........................................................................Page 15
7 System Block Diagram
Proposed Project Flow Chart.............................................................Page 16
8 - Data Analysis
8.1 - Proposed Method..........................................................................Page 17
8.2 - Proposed Implementation Flow Chart...........................................Page 17
8.3 Implementation Details.................................................................Page 18
Appendices...................................................................
........Page 54 onwards
Acknowledgement
We would like to acknowledge and extend my heartfelt gratitude to the following
persons who have made the completion of this final report possible:
Dr. Acharya Rajendra Udyavara (Ngee Ann Polytechnic]: Our project supervisor for
his vital encouragement, assistance and support. Not to forget the constant
reminders, much needed motivation and the inspiration he extended during our one
year project period.
Dr Tan Jen Hong (Ngee Ann Polytechnic]: For his assistance in collection of data for
our project.
Volunteers: For sacrificing their time to take part in our experiment.
1 - Abstract
Our eyes are perhaps one of the most important sense organ in the human
body. Without the eyes, we would not be granted vision. Our eyes are also able to
detect changes in light and colours. However, our eyes are susceptible to number of
diseases. Although non-life threatening, disease like cataract, for example, hinders
our vision.
Warm compression therapy is one of the effective treatments of dry eye
caused by Meibomian Glands dysfunction. It helps soothe the oil flow from the
glands which would eventually replenish the depleting lipid layer of the cornea;
Resulting in drop of corneal surface temperature (CST). Our aim is to verify the
effects of heat treatment through various method of image processing.
10 volunteers were subjected to the heat treatment experiment carried out in
Singapore
Eye
Research
Institute
(SERI)
under
controlled
environmental
2 - Project Statement
Analyse of effect of heat treatment for patient with dry eyes using Image
analysis techniques notably Semi-automated method, Laws Masking Energy (LME),
Fractal Dimension (FD) and Local Binary Pattern (LBP).
3 - Project Objective
Our primary objective is to study the effects of heat treatment on the eyes with
the initial assumption that the heat treatment will cause a rise in corneal surface
temperature (CST) and eventually a drop in CST an hour after the heat treatment is
applied (depleted lipid layer in cornea is replenished).
This will be done using image analysis techniques on obtained to determine
corneal surface temperature and features like fractal dimension etc. Statistical
Analysis will be done to evaluate our results to obtain a visual trend of temperature
changes by plotting graphs using excel sheets.
A Graphical User Interface (GUI) will be developed at the end to enable user
to calculate corneal surface temperature without full manual intervention.
4 Background Information
Light waves from an object enters through the cornea, makes its way through
the pupil and the colour iris (through circular opening). The Light waves will pass
through the lens located at the back of the pupils. Here, the lights rays will be
modified by the lens to focus on the retina. Located at the retina are the
photosensitive cells or photoreceptors (rod nerve cells and cones nerves cells).
These photoreceptors are connected to the optic nerves. The light waves (image)
are transmitted as electrical signal to the brains via the optic nerves (connected to
the brains).
Pupils regulate the amount of light passing through the eye such as when
large amount of light passes through (very bright), the ciliary muscles will constrict
making the hole smaller as to prevent damage to the photoreceptors located at the
back of the eye (retina and fovea centralis). Thus, dilation of the pupils is visible for
detection.
7
4.2 - Tear film
Tear film is the outermost surface of the human eye; coating the eye. This
layer film remains directly exposed to the environment. Tear film, or also known as
pre-corneal film, is made up of 3 different layers. These 3 layers are important in
maintaining a good vision and eye health. This film is continuously doused with tears
to keep moist, protect from infections and assistance in wound healing.
The 3 layers are:
Lipid (oil) Layer: The outermost layer of the film. A Hydrophobic layer that
coats the aqueous layer thus preventing fast evaporation of the aqueous layer and
keeping it moist.
Aqueous layer: The middle layer. This is the layer where nutrients, water and
ions needed to moisturize and nourish the eyes are found. This layer also plays a
vital role in keeping eyes protected from infectious agents.
Mucin (mucous) layer: The lowest layer of the film. Hydrophilic layers which
helps in even distribution of tears. This layer covers the cornea and allows the tear
film to adhere to the eye surface.
4.3 Tears
Maintenance of the cornea requires sufficient amount of tears. Our vision also
gets affected without the help of tears; it provides clear vision. Tears also have other
function: lubrication, reducing eye infection risk and washing away foreign matters
(dust and sand for example).
Tears are produced by the Lacrimal gland (or tear gland). Production of tears
is caused by emotions (crying) or by irritation.
Aging: Dry eyes can occur as part of natural process of aging. Generally,
tears production decreases as we age. A person at the age of 65-years old will have
his/her tear production rate decreases to 40% as compared to when they are
younger (18-21 years old).
Systemic diseases: Dry eye syndrome is also result from medical conditions
such as Meibomian gland dysfunction, lacrimal gland dysfunction, Blepharitis,
diabetes or arthritis.
Environmental: Extreme weather conditions like wind/ air conditioner/dry
climates or exposure to smoke/dust could result fast evaporation rate; leading to
presence of symptoms.
Others: Hormonal changes (especially in women), prolonged use of contact
lens, chemical burns and Laser refractive surgery (LASIK).
However, in our project we are more interested in dry eyes caused by
Meibomian gland dysfunction.
10
Meibomian gland dysfunction is one of the main causes of dry eyes usually
when there is blockage in the narrow duct connecting the glands to the tear film. This
results in insufficient amount of oil being released into the tear film. Insufficient
amount of oil in the lipid layer of the tear film causes the fast evaporation of the water
layer. The rate of evaporation is to increase up 10 or 20 times in the absence of this
lipid layer. Poor quality of oil is also a result of swollen or plugged glands.
11
12
Normal eye
13
5 - Project requirement
MATLAB R2007a
Introduction to Digital Image Processing by Alasdair McAndrew
Irbis Plus 2.2
Irbis Online 2.4 VarioTHERM
VarioTHERM camera and equipment for capturing infrared images of the eye
14
6 - Experimental Procedure
7.1 Data Collection Procedure
On June 28, 2011, we went down to National Eye Centre to collect our data, with
assistance of Dr. Tan Jen Hong.
The data of each test subjects were taken on 4 different intervals. Each recording
session lasted for 25 seconds.
1st interval: Baseline. Body and room temperature/humidity were recorded.
2nd interval: 20 minutes after the first interval.
After 2nd interval recording were taken, each subject will have to undergo heat
treatment. Each subject was required to put on eye mask with heating pad
(EyeGiene) for 5 minutes.
3rd interval: Immediately after eye mask removal.
4th interval: 1 hour after eye mask removal.
15
16
8- Data Analysis
8.1 Proposed Method
With the data (images) obtained from Singapore Eye Research Institute
(SERI) database, we will develop algorithms both (semi-automated and fully
automated) and implement these to our thermograms to verify the heat changes and
record the trend of ocular surface temperature changes.
SemiAutomate
d Method
Statistical
Texture
Analysis
Statistical
Analysis
Pattern (LBP)
Statistical Analysis Data compilation; Calculating average values of respective
parameter: CST, FD, LME, LBP with standard deviation. Plotting of graphs in
Microsoft Excel to obtain visual trend.
17
Temperature=[[(pixel)*(36-32)]/255]+32
18
19
% Complement of ROI
20
ROI complement
% roi filter
21
Step 5: Calculate average pixel value and determine the temperature of cornea.
count=0;
m=0;
for i=40:150
for j=140:260
if e3roi(i,j)<255
count=count+1;
n=e3roi(i,j);
m=uint32(m)+uint32(n);
end
end
end
>> V=double(m)/count % Calculate average pixel
>> T=[[(p)*(36-32)]/255]+32 % calculate temperature of cornea.
22
23
For this project, we applied the box counting method. Box counting is a
method used to establish and estimating the fractal dimension of a two-tone image..
Box-counting dimension is based on pixel counts visited by the set(images) under
measurement in a grid of varying resolution and position. Box- counting method is
more practical in analysing non self-similar images as most real-life images are non
self-similar.
Box-counting method is given based the following equation:
D=
log ( N )
1
log( )
r
24
In this method, a grid is applied to the images. Variable r is the x-axis of the
grid whereby r = 1/ (width of grid) e.g. if the grid is 120*300, r = 1/300. N is the
number of box in the grid that the picture touches. The whole process is repeated
with different sizes of boxes. It will yield a logarithmical function of box size (x-axis)
and number of boxes needed to cover fractal (y-axis). A graph on logarithmic scale
will be plotted with the obtained value. The slope obtained is referred as box
dimension, which is a suitable approximation of fractal dimension (D).
Image(s) to be implemented with box-method must be in greyscale format.
Waves
W5 = [-1, 2, 0,-2,-1]
25
These vectors are mutually multiplied, considering the first term as column
vector and second term as row vector, it will yield results in 5 X 5 Matrix. This is
known as Laws Mask.
A feature vector is derived from convolution of Laws Mask with texture image
and calculation of energy statistics; which can be used for texture description.
26
27
28
29
Right eye
Left eye
1st
33.82 0.198
33.822 0.155
2nd
33.733 0.2
33.696 0.189
3rd
34.195 0.197
34.208 0.252
4th
33.335 0.313
33.346 0.349
Table 1a
Results(Semi-automated)
34.4
34.2
34
33.8
Temperature
33.6
33.4
33.2
33
32.8
1st
2nd
Table 1b
30
3rd
4th
Left
Right
1st
1.9243
7.550E-03
1.9285
1.092E-02
2nd
1.9288
9.810E-03
1.9324
1.232E-02
3rd
1.9093
1.372E-02
1.9167
1.733E-02
4th
1.9392
1.239E-02
1.9427
1.089E-02
Table 2a
31
Axis Title
1.92
1.91
1.9
1.89
1st Recording
2nd Recording
Table 2b
3rd Recording
4th Recording
32
9.1.2.2 - Results with LME
LME 1
700000000
600000000
500000000
400000000
300000000
200000000
100000000
0
1st
2nd
3rd
4th
3rd
4th
Table 3a
LME 2
600000000
580000000
560000000
540000000
520000000
500000000
480000000
460000000
440000000
1st
2nd
Table 3b
33
LME 3
1000000000
980000000
960000000
940000000
920000000
900000000
880000000
860000000
840000000
820000000
1st
2nd
Table 3c
3rd
4th
LME 4
30000000
25000000
20000000
15000000
10000000
5000000
0
1st
2nd
3rd
4th
Table 3d
34
LME 5
45000000
40000000
35000000
30000000
25000000
20000000
15000000
10000000
5000000
0
1st
2nd
Table 3e
3rd
4th
LME 6
1000000000
980000000
960000000
940000000
920000000
900000000
880000000
860000000
840000000
1st
2nd
3rd
4th
Table 3f
35
LME 7
45000000
40000000
35000000
30000000
25000000
20000000
15000000
10000000
5000000
0
1st
2nd
Table 3g
3rd
4th
LME 8
120000000
100000000
80000000
60000000
40000000
20000000
0
1st
2nd
Table 3h
36
3rd
4th
1000000000
800000000
600000000
400000000
200000000
Table 3i
37
LBP 1
3.5
3
2.5
2
Axis Title
1.5
1
0.5
0
1st
1st
1st
1st
3rd
4th
Table 4a
LBP 2
0.06
0.06
0.06
0.05
Axis Title
0.05
0.05
0.05
0.05
1st
2nd
Table 4b
38
LBP 3
0.22
0.21
0.21
Axis Title
0.2
0.2
0.19
1st
2nd
3rd
4th
3rd
4th
Table 4c
LBP 4
5
4.5
4
3.5
3
Axis Title 2.5
2
1.5
1
0.5
0
1st
2nd
Table 4d
39
LBP 5
0.12
0.12
0.12
0.12
0.12
Axis Title 0.11
0.11
0.11
0.11
0.11
0.1
1st
2nd
3rd
4th
3rd
4th
Table 4e
LBP 6
0.33
0.33
0.32
Axis Title
0.32
0.31
0.31
1st
2nd
Table 4f
40
LBP 7
7
6
5
4
Axis Title
3
2
1
0
1st
2nd
3rd
4th
Table 4g
LBP 8
0.16
0.16
0.16
0.15
0.15
Axis Title
0.15
0.15
0.15
0.14
0.14
1st
2nd
Table 4h
3rd
4th
41
LBP 9
0.37
0.36
0.36
0.36
0.36
Axis Title
0.36
0.35
0.35
0.35
0.35
1st
2nd
Table 4i
3rd
4th
Table 4j
42
9.1.3 - Results (without eye mask)
There were 7 volunteers whom participated in test without eye mask. This is a
controlled test carried out to prove the heating treatment did cause a rise in
temperature. In this session, there were only 3 recording interval; 3 rd recording was
omitted (immediate after heat treatment).
Time Point:
1st recording Baseline
2nd recording 20 minutes after baseline
4th recording 1 hour after heat treatment
Average temperature
Recording
Left
Right
1st
33.35 0.87
33.08 0.90
2nd
33.73 0.26
33.00 0.89
4th
33.13 0.62
33.77 0.15
33.2
33
32.8
32.6
1st
2nd
4th
43
10 - GUI Development
A Graphical User Interface or GUI was developed using MATLAB with the objectives
of
1
Functions:
Load Image - Loads image chosen specifically by user. Images must be in JPEG
format and which must be the already cropped image. Loaded image will be
displayed in the axes.
44
Average Temperature This button is for calculating the average CST of the loaded
image. The results will be displayed in the box Ave.
% Pixel count
for i=40:150
for j=140:260
if im(i,j)<255
count=count+1;
n=im(i,j);
m=uint32(m)+uint32(n);
end
end
end
p=double(m)/count; % Find pixel value
T=[[(p)*(36-32)]/255]+32; % Find average temperature
Res = T; %Store temperature value in a new variable.
set(handles.Averagetext,'String',Res); %Displays temperature value as a string.
Fractal This button is for calculating the fractal dimension (FD) of the cropped eyes
images. The result of the values will be shown in the box Fractal. And a logarithmic
scaled 2-D graph will be automatically plotted onto the second axes.
45
4611- Discussion
11.1 - Summary of Work Done
With the results obtained using Semi-automated method, our results showed
the anticipated trend of temperature changes. The temperature recorded at the 4 th
interval (1 hour after heat treatment) has shown a decrease lower than the
temperature at baseline interval. The heat treatment also displays it effectiveness at
the 3rd interval. Temperature elevation occurs at the 3rd interval. We were able to
show the trend visually by plotting a bar graph using Excel spreadsheet.
As for the controlled, the results showed a no trend of temperature change. 3 rd
recording interval was omitted and the temperature at 4th does not decrease as
expected.
The mean of each extracted texture features also shows promising results.
The means at 4th recording are higher as compared to the first 2 recording. To add
on, the temperature increase at 3rd recording shows a decrease in the mean value;
verifying temperature change.
A simple GUI was developed at the end with the aim to help user to measure
corneal surface temperature along with fractal dimension with ease. This GUI can be
used for other purposes as well (non-invasive form of measuring corneal surface
temperature).
47
12 - Conclusion
Having completed our final year project with the necessary supported detailed
analysis, we were able to verify that the heat treatment is effective and that it aids
lowering down the eye temperature by replenishing the lipid layer of the cornea
(reduction in evaporation rate). It is further validated with the results of controlled and
texture analysis. Thus, we come to a general conclusion the heat treatment can be
used to treat patient with Meibomian Gland Dysfunction in the future.
The final year project has been a fruitful experience for our group. Apart from
hands-on experience on powerful software(s) like MATLAB and Microsoft Excel, we
learn the importance of teamwork.
Throughout the one year project period, there were ups and downs in terms
of morality and communications. Without a proper mindset and poor communication
between one another; a team is vulnerable to breakdown which will be unpleasant.
From this experience, we hope that we can use the knowledge we picked up
as a learning point for our future projects that we will encounter in further studies or
career.
48
13 - Problems encountered/Solutions.
Problems with Software Algorithm
The first problems we encountered were the functions in MATLAB. The book
titled Introduction to Digital Image Processing that we referred to during our
MATLAB practices was perhaps that some of the techniques taught in the book were
obsolete/doesnt work. Thus, some function will cause MATLAB errors.
The second problem was that the accuracy of the results as the Semiautomated method also involves tedious work of user input and also eyelashes
within region of interest affects the average pixel values. Thus, the temperature value
gets affected.
Another problem we faced with the semi-automated method were that this
method can only be implemented onto a greyscale image; making it necessary to
convert obtained images into greyscale, even if it has been converted into greyscale
before we processed it in MATLAB. Thus we had to display the images as greyscale
again before applying region of interest. Else, error will occur.
49
50
14 - References
51
52
53
APPENDICES
Work Plan/Timeline
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Week 7
Week 8
Week 9
Term break
Week 10
Term break
Week 11
Week 12
Week 13
Week 14
Week 15
VPP
VPP
VPP
VPP
Semester 2
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6 - 11
Week 14
week 16
Precedence list
S/N
1
1.1
1.2
1.3
1.4
1.5
Work Plan
Precedence
Research
Digital image processing(MATLAB)
Process of Semi-Automated
Process of Semi-Automated method
Process of Texture Analysis method
Collection of IR images
2.3
Software
View captured IR eye images
Image processing with obtained data
Determine temperature and Average
pixel value
2.4
Texture Analysis
2.1
2.2
After 1.5
After 2.1
After 1.2, 1.3, 1.5, 2.1,
2.2
After 1.2, 1.3, 1.4, 1.5,
2.1,
2.2, 2.3
Task
Zul
Primary
Primary
Zar Li
Primary
Primary
Primary
Primary
Primary
Primary
Primary
Secondary
Primary
Primary
Research on Semi-Automated
Research on Texture Analysis
Research(general)
Primary
Secondary
Secondary
Secondary
Secondary
Primary
Gantt Chart
GUI
Primary
Secondary
Secondary
Primary
Using MATLAB(R2007a)
Digital Image processing techniques
Running of Semi-automated method
Wei Yan
Primary
Primary
Seconda
ry
Seconda
ry
Primary
Primary
Seconda
ry
Primary
Primary
Seconda
ry
Primary
Breakdown Structure
S/N
Duration(weeks)
Resource
Introduction to Digital
Image
processing by Alasdair
McAndrew
Reference slides from
supervisor
Reference slides from
supervisor
Data Analysis
Semi-automated codes
VPP
Taught by Supervisor
VPP
VPP
1
2
Work structure
Digital Image processing
techniques
Research on Semi-automated
Method
6-7
1
VPP
obtained data
7
Various websites+books
GUI
Various books
s=2;
[m n]=size(I);
M=max(m,n);
p=0;
while max(m,n)>2
S=((255*(s/max(m,n))));
Nr=0;
for i=2:2:m-1
sum=0;
for j=2:2:n-1
X=[(Imax(i,j)),(Imax(i,j+1)),(Imax(i+1,j)),(Imax(i+1,j+1))];
Imax(i/2,j/2)=max(X);
Y=[Imin(i,j),Imin(i,j+1),Imin(i+1,j),Imin(i+1,j+1)];
Imin(i/2,j/2)=min(Y);
sum=sum+double((((Imax(i/2,j/2))/S)-((Imin(i/2,j/2))/S)))+1;
end
Nr=Nr+sum;
end
r=s/M;
if Nr
p=p+1;
N(p)=Nr;
r1(p)=r;
D=log(Nr)/log(1/r);
end
s=s*2;
m=m/2;
n=n/2;
end
plot(log(1./r1),log(N))
xlabel('log(1/r)');
ylabel('log(N)'); % plots a logarithmic graphs
X=(log(1./r1)*log(1./r1)');
X1=inv(X);
FD=X1*(log(1./r1))*(log(N)')
dat=[dat ;FD];
pa=cd(Directory name );
end
end
end
for m = 1:len
for n = 1:len
new = zeros(sz);
for i=1:sz(1)
for j = 1:sz(2)
new(i,j) = (all_img{m,n}(i,j)^2);
end
end
new_sum = sum(new(:));
eng_all_img(m,n) = (new_sum);
end
end
function all_filters = lawsfilter(laws_mask)
len = length(laws_mask);
all_filters = cell(len,len);
for i = 1:len
for j = 1:len
all_filters{j,i} = conv2((laws_mask(i,:)),(laws_mask(j,:))');
end
end
nbr = (expertwin(o_img,i,j,len));
s = sum(mask(:));
if(s==0)
nbr_filt_mul = (mask) .* (nbr);
temp(i,j) = double(sum(nbr_filt_mul(:)));
else
nbr_filt_mul = (mask) .* (nbr);
temp(i,j) = sum(nbr_filt_mul(:))/s;
end
end
end
all_img{m,n} = temp;
end
end
L3 = [1 2 1];
E3 = [-1 0 1];
S3 = [-1 2 -1];
out_put = [L3;E3;S3];
elseif(w_s==5)
L5 = conv(L3,L3);
E5 = conv(L3,E3);
S5 = conv(L3,S3);
W5 = conv(-E3,S3);
R5 = conv(S3,S3);
out_put = [L5;E5;S5;W5;R5];
elseif(w_s==7)
L7 = conv(conv(L3,L3),L3);
E7 = conv(conv(L3,L3),E3);
S7 = conv(conv(L3,L3),S3);
W7 = conv(-(conv(L3,S3)),E3);
R7 = conv(conv(-E3,S3),E3);
O7 = conv(conv(S3,S3),S3);
out_put = [L7;E7;S7;W7;R7;O7];
else
error('invalid mask size, it should be 3,5 or 7 ')
end
pa=cd('C:\Users\User\FYP\Thyroid\CEUS\CEUS
Unprocessed\Benign\Benign02\Cropped');
qq=dir;
dat=[];
kk=0;
for i=1:length(qq)
i
if strfind(qq(i,1).name,'.jpg')
filename=(qq(i,1).name);
I1=imread(filename);
if length(size(I1))==3
I=rgb2gray(I1);
else
I=I1;
end
cd('C:\Users\User\FYP\Thyroid\Group\LME')
eng_all_img = lawsanalysis(I,3)
fea=[eng_all_img(1,2) eng_all_img(1,3) eng_all_img(2,1) eng_all_img(2,2)
eng_all_img(2,3) eng_all_img(3,1) eng_all_img(3,2) eng_all_img(3,3)];
dat=[dat ;fea];
pa=cd('C:\Users\User\FYP\Thyroid\CEUS\CEUS
Unprocessed\Benign\Benign02\Cropped');
end
end
img=inputimage;
if isrgb(img)
I=rgb2gray(img);
else
I=img;
end
I1=img;
radius=[1 2 3];
noofpts=[8 16 24];
counter=1;
transcount=0;
featurevector=0;
epithelialpixel=find(I>0);
actualpixel=size(epithelialpixel,1);
[M,N]=size(I);
I(M+1,:)=zeros(1,N);
I(:,N+1)=zeros(M+1,1);
% I=padarray(I,[radius(size(radius,2)) radius(size(radius,2))],0,'both');
for i=1:size(radius,2)
transcount=0;
for j=1+radius(i):size(I,1)-radius(i)
for k=1+radius(i):size(I,2)-radius(i)
if (I(j,k)>0)
ptarray=zeros(1,noofpts(i));
%ptcount=1:noofpts(i);
%theta=2*pi*(ptcount-1)/noofpts(i)-pi/2;
for ptcount=1:noofpts(i)
theta=2*pi*(ptcount-1)/noofpts(i)-pi/2;
%
disp([num2str((j+radius(i)*cos(theta))) ','
num2str((k+radius(i)*sin(theta)))]);
vararray(ptcount)=I(round(j+radius(i)*cos(theta)),round(k+radius(i)*sin(theta)));
end
ptarray=sign(vararray-I(j,k));
%
minarray=zeros(1,noofpts(i)-1);
I(j,k)
vararray
ptarray
transition=sum(abs(diff(double(ptarray))));
transition=transition+abs(ptarray(noofpts(i))-ptarray(1));
%
transition=size(findstr('01',num2str(ptarray,-
8)),2)+size(findstr('10',num2str(ptarray,-8)),2);
%
transition
if transition<uniformitythreshold+1
if transition==0
img2(j,k)=2.^(noofpts(i)-1:-1:0)*double(ptarray');
else
minarray(1)=2.^(noofpts(i)-1:-1:0)*double(ptarray');
for l=2:noofpts(i)
minarray(l)=2*minarray(l-1)-(2^noofpts(i)-1)*ptarray(l-1);
%
temp=dec2bin(bitshift(bin2dec(num2str(ptarray,-8)),-
temp(1)=num2str(ptarray(noofpts(i)));
1),noofpts(i));
%minarray(l)=bin2dec(temp);
%ptarray=temp;
end
%clear ptarray transition
img2(j,k)=min(minarray);
end
else
transcount=transcount+1;
img2(j,k)=2^noofpts(i);
end
img3(j,k)=std(double(vararray));
break
else
img2(j,k)=0;
img3(j,k)=0;
end
end
%
break
end
% break
finalfeaturevector(counter)=sum(sum(img3))/actualpixel;
finalfeaturevector(counter+1)=sum(sum(img2))/((2^noofpts(i))*actualpixel);
imgvar=img2(I1>0);
finalfeaturevector(counter+2)=std(imgvar)/(2^noofpts(i));
counter=counter+3;
% mean2(img3);
% mean2(img2)/2^noofpts(i);
% std2(img2)/2^noofpts(i);
% counter/(size(img,1)*size(img,2))*100;
% img2
%
figure,imshow((img2)/256);
% transcount/(size(img,1)*size(img,2))*100
end
end
kk=0;
%for i=1:length(qq)
for i=1:52
i
if strfind(qq(i,1).name,'.jpg')
filename=(qq(i,1).name);
I=imread(filename);
if length(size(I))==3
I1=rgb2gray(I);
else
I1=I;
end
cd('C:\Users\aru\Desktop\Group\LBP')
[F]=lbp(I1,2);
dat=[dat ;F];
pa=cd('Directory of images');
end
end
MATLAB
Matlab, matrix labtoratory, is a high-level technical computing language and
interactive environment for algorithm development, data visulization, data analysis
and numeric computation, plotting of functions and data, implementation of
algorithms, matrix manipulations creation of user interfaces and interfacing with
programs written in other languages, including C-sharp, C plus plus, Java and
Fortran.
Although Matlab is invented primarily for numerical computing, an optional toolbox
which allows access to symbolic computing capabilities uses the MuPAD symbolic
engine.
Simulink adds graphical multi-domain simulatoin and Model-Based Design for
dynamic and embedded systems.
Matlab is widely used in all kinds of fields, engineering, science and economics.
GUI = Graphical User Interface
Figure window
Contains useful actions in its menu and toolbars zooming in and out, rotating 3-D
axes, copying and pasting, plot edit mode, property editor, saving and exporting
(figures can be saved in binary .fig file format, and figures can be exported to many
different kinds of standard graphics file formats like GIF, PNG, JPEG, TIFF, BMP,
PCX, EPS.
Modifying object properties
-
Returning a list of all user-settable object properties and their current values
*set(handle)
*Example:get(gcf, Color)
-
All the above can properties can be done (not at runtime) using the Property Editor.
.m file which contains the code that controls the GUI. We can program the
callbacks in this .m file using the M-file Editor.
Types of GUI
-
GUI (default)
Quit Button
function Quitbutton_Callback(hObject, eventdata, handles)
qns_ans = questdlg ('Close window ?','Closing Window','Yes','No','No')
if strcmp(qns_ans,'Yes')
msgbox('Goodbye')
close(handles.figure1)
end
Fractal Button
global im;
[m1 n1]=size(im);
if mod(m1,4)~=0
k=mod(m1,4);
p=zeros(4-k,n1);
im=[im ;p];
m1=size(I,1);
end
if mod(n1,4)~=0
l=mod(n1,4);
p=zeros(m1,4-l);
im=[im p];
end
Imax=double(im);
Imin=double(im);
s=2;
[m n]=size(im);
M=max(m,n);
p=0;
while max(m,n)>2
S=((255*(s/max(m,n))));
Nr=0;
for i=2:2:m-1
sum=0;
for j=2:2:n-1
X=[(Imax(i,j)),(Imax(i,j+1)),(Imax(i+1,j)),(Imax(i+1,j+1))];
Imax(i/2,j/2)=max(X);
Y=[Imin(i,j),Imin(i,j+1),Imin(i+1,j),Imin(i+1,j+1)];
Imin(i/2,j/2)=min(Y);
sum=sum+double((((Imax(i/2,j/2))/S)-((Imin(i/2,j/2))/S)))+1;
end
Nr=Nr+sum;
end
r=s/M;
if Nr
p=p+1;
N(p)=Nr;
r1(p)=r;
D=log(Nr)/log(1/r);
end
s=s*2;
m=m/2;
n=n/2;
end
axes(handles.axes7);
plot(log(1./r1),log(N))
xlabel('log(1/r)');
ylabel('log(N)');
X=(log(1./r1)*log(1./r1)');
X1=inv(X);
FD=X1*(log(1./r1))*(log(N)');
Res = FD;
set(handles.Fractaltext,'String',Res);
Reset Button
function Reset_Callback(hObject, eventdata, handles)
cla(handles.axes7,'reset');
cla(handles.axes1, 'reset');
set(handles.edit3,'String','');
set(handles.Averagetext,'String','');
set(handles.Fractaltext,'String','');