You are on page 1of 3

IMAGE ENHANCEMENT BY POWER LAW

clc;
clear all;
close all;
a=im2double(imread('cameraman.tif'));
b=a.^0.45;
figure;imshow(a);title('Original image');
figure;imshow(b);title('After power law transforming');

IMAGE ENHANCEMENT BY LOG


TRANSFORMATION
clc;
clear all;
close all;
k=imread('peppers.png');
l=k.*log(22);
subplot(1,2,1);imshow(k);title('Original image');
subplot(1,2,2);imshow(l);title('Log transforming');

IMAGE ENHANCEMENT BY GLOBAL HISTOGRAM

clc;
clear all;
close all;
a=imread('pout.tif');
b=histeq(a);
figure;subplot(1,2,1);imshow(a);title('Original image');
subplot(1,2,2);imshow(b);title('After Global Histogram Equalized');
figure;subplot(1,2,1);imhist(a);title('Histogram of Original Image');
subplot(1,2,2);imhist(b);title('Histogram of Global Histogram Equalized
Image');
IMAGE ENHANCEMENT BY LOCAL HISTOGRAM
clc;
clear all;
close all;
a=im2double(imread('coins.png'));
w=input('Enter the window size:');
k=input('Enter the value of the constant k(value should be between 0 and
1):');
M=mean2(a);
z=colfilt(a,[w w],'sliding',@std);
m=colfilt(a,[w w],'sliding',@mean);
A=k*M./z;
b=A.*(a-m)+m;
figure;subplot(1,2,1);imshow(a);title(‘Original Image’);
subplot(1,2,2);imshow(b);title(‘Local Histogram Equalized Image’);

IMAGE ENHANCEMENT BY GLOBAL THRESHOLD


clc;
clear all;
close all;
f=im2double(imread('cameraman.tif'));
figure;imshow(f);title('Original Image');
t=graythresh(f);
f1=f;
f(f1<t);
f1(f1>=t)=1;
figure;imshow(f1);title('Single Threshold Image');
f2=f;
f2(f2>=t+0.38)=1;
f2(f2<t-0.38)=0;
figure;imshow(f2);title('Double Threshold Image');

You might also like