blob: 4c4c3d656104fcc7dd4a7e5459b03b9e23473b6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
//Ex3_11
// Computing Histogram Statistic
// Version : Scilab 5.4.1
// Operating System : Window-xp, Window-7
//Toolbox: Image Processing Design 8.3.1-1
//Toolbox: SIVP 0.5.3.1-2
//Reference book name : Digital Image Processing
//book author: Rafael C. Gonzalez and Richard E. Woods
clc;
close;
clear;
xdel(winsid())//to close all currently open figure(s).
a=uint8([0 0 1 1 2;1 2 3 0 1;3 3 2 2 0;2 3 1 0 0;1 1 3 2 2]);
L=max(a);
[P Q]=size(a);
/////////////////////////// Global Histogram Equalization /////////////////////////
[count cell]=imhist(a);
//figure,bar(cell(1:L+1),count(1:L+1),0.2);
//title('Histogram');
r=cell(1:L+1)'; // Transpose of matrix
nk=round(count(1:L+1))'; // Transpose of matrix
M=sum(nk);
probeblity_r=nk/M; // Probablity calculation
sum_1=0;
for i=1:length(r)
sum_1=sum_1+(r(i)*probeblity_r(i));
end
Mean=sum_1;
disp('Probablity:');
disp(probeblity_r);
disp('Mean:');
disp(Mean);
Mean1=mean(double(a));
disp('Mean Calculated from (5*5)Image:');
disp(Mean1);
|