Tuesday, 27 August 2013

matlab program for spatial enhancement

%demo for spatial enhancements

clear all;
clc;

img=imread('face1.jpg');
img_gray=rgb2gray(img);
img_inv=255-img_gray;      %image inversion
%dynamic_comp=log(1+img_gray(1:end,1:end)); %image compressing dynamic ran

figure
imshow(img_gray);
figure
imshow(img_inv);

%image subtraction
img_sub=img_gray-img_inv;
figure
imshow(img_sub);

%image addition
%img_add=img_gray+img_inv;
%figure
%imshow(img_add);

%image averaging
img_avg=(img_gray+img_inv)/2;
figure
imshow(img_avg);

No comments:

Post a Comment