完成实验三

This commit is contained in:
张梦南 2025-05-28 18:34:40 +08:00
parent b7bf853bea
commit d8f90dbc3c
5 changed files with 98 additions and 0 deletions

BIN
EXP_3_4/airport.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
EXP_3_4/circle.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
EXP_3_4/circuit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

BIN
EXP_3_4/test.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

98
EXP_three.m Normal file
View File

@ -0,0 +1,98 @@
%
image = imread('EXP_3_4/test.jpg');
image_airport = imread('EXP_3_4/airport.jpg');
%
h1 = [1 1 1; 1 1 1; 1 1 1] / 9;
h2 = [1 2 1; 2 4 2; 1 2 1] / 16;
h3 = [-1 -1 -1; -1 9 -1; -1 -1 -1];
h4 = [0 -1 0; -1 5 -1; 0 -1 0];
h5 = [-1 -1 -1; -1 10 -1; -1 -1 -1];
h6 = [-1 -1 -1; -1 8 -1; -1 -1 -1];
h7 = [1 1 1; 1 -8 1; 1 1 1];
h8 = [-1 0 1; -2 0 2; -1 0 1];
h9 = [-1 -2 -1; 0 0 0; 1 2 1];
h10 = [1 -1];
h11 = [1 0 -1];
%
image_h1 = imfilter(image, h1);
image_h2 = imfilter(image, h2);
image_h3 = imfilter(image, h3);
image_h4 = imfilter(image, h4);
image_h5 = imfilter(image, h5);
image_h6 = imfilter(image, h6);
image_h7 = imfilter(image_airport, h7);
image_h8 = imfilter(image_airport, h8);
image_h9 = imfilter(image_airport, h9);
image_h10 = imfilter(image_airport, h10);
image_h11 = imfilter(image_airport, h11);
image_add = abs(image_h8) + abs(image_h9);
%
figure;
subplot(1,3,1);
imshow(image);
title('Original Image'); %
subplot(1,3,2);
imshow(image_h1);
title('Mean Smoothing'); %
subplot(1,3,3);
imshow(image_h2);
title('Gaussian Smoothing'); %
figure;
subplot(1,3,1);
imshow(image);
title('Original Image'); %
subplot(1,3,2);
imshow(image_h3);
title('Sharpening one'); %
subplot(1,3,3);
imshow(image_h4);
title('Sharpening two'); %
figure;
subplot(1,3,1);
imshow(image);
title('Original Image'); %
subplot(1,3,2);
imshow(image_h5);
title('Energy Enchancement'); %
subplot(1,3,3);
imshow(image_h6);
title('Energy Weakening'); %
figure;
subplot(1,2,1);
imshow(image_airport);
title('Original Image'); %
subplot(1,2,2);
imshow(image_h7);
title('Grayed Image'); %
figure;
subplot(2,2,1);
imshow(image_airport);
title('Original Image'); %
subplot(2,2,2);
imshow(image_h8);
title('Horizon'); %
subplot(2,2,3);
imshow(image_h9);
title('Vertical'); %
subplot(2,2,4);
imshow(image_add);
title('Overlay'); %
figure;
subplot(1,3,1);
imshow(image_airport);
title('Original Image'); %
subplot(1,3,2);
imshow(image_h10);
title('Easy Edge one'); %
subplot(1,3,3);
imshow(image_h11);
title('Easy Edge two'); %