0% found this document useful (0 votes)
60 views5 pages

* Ảnh âm bản

The document discusses various image processing techniques in MATLAB including: 1) Image enhancement techniques like gamma correction, logarithmic transform, and contrast stretching are demonstrated. 2) Filtering techniques such as mean filtering with different padding methods, median filtering for noise removal, and sharpening filter are shown. 3) Edge detection using Prewitt and Sobel filters to find horizontal and vertical edges in an image. 4) Maximum and minimum filters are applied using neighborhood functions to reduce salt and pepper noise.

Uploaded by

minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views5 pages

* Ảnh âm bản

The document discusses various image processing techniques in MATLAB including: 1) Image enhancement techniques like gamma correction, logarithmic transform, and contrast stretching are demonstrated. 2) Filtering techniques such as mean filtering with different padding methods, median filtering for noise removal, and sharpening filter are shown. 3) Edge detection using Prewitt and Sobel filters to find horizontal and vertical edges in an image. 4) Maximum and minimum filters are applied using neighborhood functions to reduce salt and pepper noise.

Uploaded by

minh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

* Ảnh âm bản:

I=imread('tire.tif');

imshow(I)

J=imcomplement(I);

figure, imshow(J)

* Biến đổi gamma:

I=imread('tire.tif');

J=imadjust(I,[],[],1);

J2=imadjust(I,[],[],3);

J3=imadjust(I,[],[],0.4);

imshow(J);

figure,imshow(J2);

figure,imshow(J3);

* Biến đổi logarit:

I=imread('tire.tif');
imshow(I)
I2=im2double(I);
J=1*log(1+I2);
J2=2*log(1+I2);
J3=5*log(1+I2);
figure,imshow(J)
figure,imshow(J2)
figure, imshow(J3)

* Kéo dài độ tương phản:

I=imread('tire.tif');
I2=im2double(I);
m=mean2(I2)
contrast1=1./(1+(m./(I2+eps)).^4);
contrast2=1./(1+(m./(I2+eps)).^5);
contrast3=1./(1+(m./(I2+eps)).^10);
imshow(I2)
figure,imshow(contrast1)
figure,imshow(contrast2)
figure,imshow(contrast3)

* Lọc trung bình và padding:

Với h =

0.0400 0.0400 0.0400 0.0400 0.0400

0.0400 0.0400 0.0400 0.0400 0.0400

0.0400 0.0400 0.0400 0.0400 0.0400

0.0400 0.0400 0.0400 0.0400 0.0400

0.0400 0.0400 0.0400 0.0400 0.0400

a=imread('C:\Users\pc\Downloads\cat.jpg');

imshow(a); title('Original');

h=fspecial('average',5);

a1=imfilter(a,h);

figure; imshow(a1); title('zero-padding');

a2=imfilter(a,h,'replicate');

figure; imshow(a2); title('replicate');

a3=imfilter(a,h,'symmetric');

figure; imshow(a3); title('symmetric');

a4=imfilter(a,h,'circular');

figure; imshow(a4); title('circular');


* Lọc trung vị:

a = imread('eight.tif');

b = imnoise(a,'salt & pepper',0.02);

figure, imshow(b)

c = medfilt2(b,[3 3]);

figure, imshow(c)

* Làm sắc nét:

- Với h =

-0.1667 -0.6667 -0.1667

-0.6667 4.3333 -0.6667

-0.1667 -0.6667 -0.1667

I=imread('pout.tif');

figure; imshow(I);

h=fspecial('unsharp');

a=imfilter(I,h);

figure; imshow(a)

* Edge-detection:

(Prewit) h 1 = 1 1 1

0 0 0

-1 -1 -1

(Sobel) h2 = 1 2 1

0 0 0
-1 -2 -1

- Tìm cạnh ngang:

I=imread('circuit.tif');

figure; imshow(I);

h1=fspecial('prewit');

h2=fspecial('sobel');

a1=imfilter(I,h1);

a2=imfilter(I,h2);

figure; imshow(a1); title('Prewit');

figure; imshow(a2); title('Sobel');

- Tìm cạnh đứng:

I=imread('circuit.tif');

figure; imshow(I);

h1=fspecial('prewit');

h2=fspecial('sobel');

a1=imfilter(I,h1');

a2=imfilter(I,h2');

figure; imshow(a1); title('Prewit');

figure; imshow(a2); title('Sobel');

* Max filter:

a=imread('C:\Users\pc\Desktop\Nhóm 20_A02\pepper noise.jpg');

imshow(a)

maxf=@(x) max(x(:));

b=nlfilter(rgb2gray(a),[3 3],maxf);
figure; imshow(b)

* Min filter:

a= imread('C:\Users\pc\Desktop\Nhóm 20_A02\salt noise.jpg');

imshow(a)

minf=@(x) min(x(:));

b=nlfilter(rgb2gray(a),[3 3],minf);

figure; imshow(b)

You might also like