We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14a0d51 commit dc0d841Copy full SHA for dc0d841
Histogram Equalization/histogram.bmp
3 MB
Histogram Equalization/histogram.m
@@ -0,0 +1,46 @@
1
+clear all
2
+clc
3
+a = imread('pout.tif');
4
+a = double(a);
5
+big = max(max(a));
6
+[row col] = size(a);
7
+C = row*col;
8
+h = zeros(1,300);
9
+z = zeros(1,300);
10
+for n=1:1:row
11
+ for m=1:1:col
12
+ if a(n,m) == 0
13
+ a(n,m) = 1;
14
+ end
15
16
+end
17
18
19
+ t = a(n,m);
20
+ h(t) = h(t) + 1;
21
22
23
+pdf = h/C;
24
+cdf(1) = pdf(1);
25
+for x=2:1:big
26
+cdf(x) = pdf(x) + cdf(x-1);
27
28
+new = round(cdf*big);
29
+new = new + 1;
30
+for p=1:1:row
31
+ for q=1:1:col
32
+ temp = a(p,q);
33
+ b(p,q) = new(temp);
34
+ t = b(p,q);
35
+ z(t) = z(t)+1;
36
37
38
+b = b-1;
39
+subplot(2,2,1)
40
+imshow(uint8(a))
41
+subplot(2,2,2)
42
+bar(h)
43
+subplot(2,2,3)
44
+imshow(uint8(b))
45
+subplot(2,2,4)
46
+bar(z)
0 commit comments