JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
4 days ago11 views
👨‍💻Programming

Untitled Page

% PRACTICAL NO: 1

% AIM: Image Enhancement in Spatial Domain.

% Apply Log Transformation to the given input image

% and display the resulting image.

clc;

clear all;

close all;

a = imread('C:\IP\images.jpg');

a = double(rgb2gray(a));

c = 255 / log(256);

b = c * log(1 + a);

b = uint8(b);

imshow(b);

title('Log Transformation');



% PRACTICAL NO: 1

% AIM: Image Enhancement in Spatial Domain.

% Apply Power Law Transformation to the given input image

% and display the resulting image.

clc;

clear all;

close all;

a = imread('C:\IP\images.jpg');

b = double(a);

subplot(1,2,1);

imshow(a);

title('Original Image');

k = 1;

gamma = 1;

[m,n] = size(b);

for i = 1:m

for j = 1:n

c(i,j) = k * (b(i,j)^gamma);

end

end

subplot(1,2,2);

imshow(uint8(c));

title('Power Law Image');



% PRACTICAL NO: 1

% AIM: Image Enhancement in Spatial Domain.

% Apply Negation to the given input image

% and display the resulting image.

clc;

clear all;

close all;

a = imread('C:\IP\images.jpg');

a = rgb2gray(a);

subplot(1,2,1);

imshow(a);

title('Original Image');

[m,n] = size(a);

for i = 1:m

for j = 1:n

c(i,j) = 255 - a(i,j);

end

end

subplot(1,2,2);

imshow(uint8(c));

title('Negation Image');



% PRACTICAL NO: 1

% AIM: Display dark, bright, low contrast and high contrast

% images by applying contrast stretching on an input image.

clc;

clear all;

close all;

a = imread('C:\IP\images.jpg');

a = im2double(a);

subplot(2,3,1);

imshow(a);

title('Original Image');

dark = a * 0.4;

subplot(2,3,2);

imshow(dark);

title('Dark Image');

bright = a * 1.5;

bright(bright > 1) = 1;

subplot(2,3,3);

imshow(bright);

title('Bright Image');

low = 0.5 * a + 0.25;

subplot(2,3,4);

imshow(low);

title('Low Contrast Image');

high = imadjust(a,[0.3 0.7],[0 1]);

subplot(2,3,5);

imshow(high);

title('High Contrast Image');





% PRACTICAL NO: 1

% AIM: Apply Gray-Level Slicing with and without

% background to the given input image.

clc;

clear all;

close all;

a = imread('C:\IP\images.jpg');

a = rgb2gray(a);

[m,n] = size(a);

b = zeros(m,n);

c = a;

for i = 1:m

for j = 1:n

if a(i,j) >= 100 && a(i,j) <= 200

b(i,j) = 255;

c(i,j) = 255;

end

end

end

subplot(1,3,1);

imshow(a);

title('Original Image');

subplot(1,3,2);

imshow(uint8(b));

title('Without Background');

subplot(1,3,3);

imshow(uint8(c));

title('With Background');



% PRACTICAL NO: 1

% AIM: Apply Bit-Plane Slicing to the given input image

% and display the resulting image.

clc;

clear all;

close all;

a = imread('C:\IP\images.jpg');

a = rgb2gray(a);

subplot(3,3,1);

imshow(a);

title('Original Image');

for k = 0:7

b = bitget(a,k+1) * 255;

subplot(3,3,k+2);

imshow(b);

title(['Bit Plane ',num2str(k)]);

end
← Back to timeline