0% found this document useful (0 votes)
24 views4 pages

Image Enhancement: 'Img - JPG'

digital image processing

Uploaded by

thalapathir319
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)
24 views4 pages

Image Enhancement: 'Img - JPG'

digital image processing

Uploaded by

thalapathir319
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
You are on page 1/ 4

Image Enhancement

-----------------------------
% Read the original image
A1 = imread('img.jpg');

% High Contrast the image (using 1.2 to increase contrast)


B = A1 * 1.2;

% Low contrast of the image (using 0.2 to decrease contrast)


C = A1 * 0.2;

% Create the negative image


L = 256;
N1 = (L - 1) - A1;

% Display all images in one window with subplots


figure;

subplot(2, 2, 1);
imshow(A1);
title('Original Image');

subplot(2, 2, 2);
imshow(B);
title('High contrast Image');

subplot(2, 2, 3);
imshow(C);
title('Low Contrast Image');

subplot(2, 2, 4);
imshow(N1);
title('Negative Image');
Histogram Equalization
-----------------------------------
% Read an image original image
f = imread('img.jpg');

% Perform histogram equalization


g = histeq(f, 256);

% Create a figure with 2x2 subplots


figure;

% Display the original image


subplot(2, 2, 1);
imshow(f);
title('Original Image');

% Display the histogram of the original image


subplot(2, 2, 2);
imhist(f);
title('Histogram of Original Image');
ylim('auto');

% Display the histogram-equalized image


subplot(2, 2, 3);
imshow(g);
title('Histogram Equalized Image');

% Display the histogram of the equalized image


subplot(2, 2, 4);
imhist(g);
title('Histogram of Equalized Image');
ylim('auto');
Image Restoration
-----------------------------
% Load and preprocess the image
originalImage = imread('img.jpg');
% Convert to grayscale if necessary
originalImage = rgb2gray(originalImage);
% Convert to double for processing
originalImage = double(originalImage);

% Define a PSF (Point Spread Function) and degrade the image


% Gaussian blur
psf = fspecial('gaussian', [5 5], 2.0);
degradedImage = imfilter(originalImage, psf, 'symmetric',
'conv');
% Add Gaussian noise
noise = 0.1 * randn(size(degradedImage));
degradedImage = degradedImage + noise;

% Restore the image using Wiener filter


estimatedImage = wiener2(degradedImage, [5 5], 0.1);

% Display all images in a single figure


figure;

subplot(1, 3, 1);
imshow(originalImage, []);
title('Original Image');

subplot(1, 3, 2);
imshow(degradedImage, []);
title('Degraded Image');

subplot(1, 3, 3);
imshow(estimatedImage, []);
title('Restored Image');

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy