Thursday, March 12, 2009

Contrast Stretching of Image

% Contrast Stretching
% Read a gray scale image and apply appropriate mathematical function to
% stretch its contrast levels
clear all; close all; clc;
f = imread('cameraman.tif');
f = im2double(f);
m=0.75; %contrast
E=0.55; %slope of the function
g = 1./(1+(m./(f+eps)).^E);
figure,imshow(f),title('Original Image');
figure,imshow(g),title('Contrast stretched Image');

No comments: