0% found this document useful (0 votes)
6 views2 pages

Pr-2 Codes

Important codes of BIP PRACTICE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Pr-2 Codes

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

clc;

clear all;
close all;
% ******** image negatives *****
% s=L-1-r
Gamma = 6
ori_im=imread("D:\BIP PRACTICALS\sample images\DIP3E_Original_Images_CH03\1.tif");
in=255-ori_im;
figure, subplot(2,3,1),imshow(ori_im);title('Original Image')
subplot(2,3,2),imshow(in);title('Image Negative')
% *********** image log transformation*******
o1_im=imread("D:\BIP PRACTICALS\sample images\DIP3E_Original_Images_CH03\2.tif");
o1=im2double(o1_im);
% s=c*log(1+r)
% 1) c=0.1
l1=0.1.*log(1+o1);
l1=im2uint8(l1);
subplot(2,3,3),imshow(o1_im);title('original image');
subplot(2,3,4),imshow(l1);title('log transformation image with c=0.1');
% 2) c=1
l2=1.*log(1+o1);
l2=im2uint8(l2);
subplot(2,3,5),imshow(l2);title('log transformation image with c=1');
% 3) c=10
l3=10*log(1+o1);
l3=im2uint8(l3);
subplot(2,3,6),imshow(l3);
title('log transformation image with c=10 ')
% ********* power transformation*********
im1=imread("D:\BIP PRACTICALS\sample images\DIP3E_Original_Images_CH03\3.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=1');
% 3) c=1 & y=0.3
gm3=im1.^(0.3);
subplot(2,2,4),imshow(gm3); title('gamma correction, c=1,gamma=3');

You might also like