0% found this document useful (0 votes)
4 views1 page

Practical2 Code

Practical 2 code
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Practical2 Code

Practical 2 code
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

clc;

clear all;
close all;

% ******** image negatives *****


% s=L-1-r

ori_im=imread('D:\BIP PRACTICALS\sample images\DIP3E_Original_Images_CH03\[Link]');


in=255-ori_im;
figure, subplot(3,2,1),imshow(ori_im);title('Original Image')
subplot(3,2,2),imshow(in);title('Image Negative')

% *********** image log transformation*******


o1_im=imread('D:\BIP PRACTICALS\sample images\DIP3E_Original_Images_CH03\Fig0316(3)
(third_from_top).tif');
o1=im2double(o1_im);
% s=c*log(1+r)
% 1) c=0.1
l1=0.1.*log(1+o1);
l1=im2uint8(l1);
figure,subplot(2,2,1),imshow(o1_im);title('original image');
subplot(2,2,2),imshow(l1);title('log transformation image with c=0.1');
% 2) c=1
l2=1.*log(1+o1);
l2=im2uint8(l2);
subplot(2,2,3),imshow(l2);title('log transformation image with c=1');
% 3) c=10
l3=10*log(1+o1);
l3=im2uint8(l3);
subplot(2,2,4),imshow(l3);
title('log transformation image with c=10 ')
% ********* power transformation*********
im1=imread('D:\BIP PRACTICALS\sample images\DIP3E_Original_Images_CH03\Fig0308(a)
(fractured_spine).tif');
im1=im2double(im1);
% s=cr^y
% 1) c=1 & y=0.6
gm1=im1.^(0.6);
figure,subplot(2,2,1),imshow(im1);title('original image');
subplot(2,2,2),imshow(gm1);title('gamma correction, c=1, gamma=0.6');
% 2) c=1 & y=0.4
gm2=im1.^(0.4);
subplot(2,2,3),imshow(gm2); title('gamma correction, c=1,gamma=0.4');
% 3) c=1 & y=0.3
gm3=im1.^(0.3);
subplot(2,2,4),imshow(gm3); title('gamma correction, c=1,gamma=0.3');

You might also like