数字图像处理与分析实验9 综合练习(一)_参考答案.

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

实验9 综合练习(一)

实验目的:

1.对需要进行处理的图像分析,正确运用所学的知识,采用

正确的步骤,对图像进行各类处理,以得到令人满意的图

像效果。

实验内容:

1.将bone_scan.jpg图像文件读入Matlab,按照以下步骤对

其进行处理:

a)用带对角线的Laplacian对其处理,以增强边缘。

W1=[-1 -1 -1

-1 8 -1

-1 -1 -1]

b)用imadd函数叠加原始图像,可以看出边界增强了,但

噪声增强了,应想法降低。

c)对原图像进行Sobel滤波。(用fspecial生成)

d)并用imfilter对(c)的结果进行5×5邻域平均,以减

少噪声。

e)用immultiply函数处理经(b)步骤和(d)步骤处理

后的图像,噪声得以减少。

f)最后用imadjust函数做幂次灰度变换,以增强dynamic

range。(多试几次,参考:γ取0.5)

要求用imshow函数显示经每一步处理后的图像,比对效果。

参考程序与处理结果

========================================================= =============

%Enhancing a image of whole body bone scan by combining various spatial

% enhancement methods, the strategies is as following:

% ========================================================

% 1. Utilize the Laplacian to highlight fine detail

% 2. Utilize the gradient to enhance prominent edges

% 3. Combine Laplacian and gradient to get the detail-enhanced and noise-compressed image % 4. Increase the contrast of low gray levels by using a gray-level transformation.

% ==========================================================

% The original image named 'Fig0306(a)(bone-scan).tif' is under the

% directory: J:\course teaching\ҽѧͼÏñ´¦Àí\ʵÑé\ʾÀýͼÏñ

% Copyright by Huang zhongchao, July 16, 2006

clear all;

close all;

f = imread('J:\course teaching\ҽѧͼÏñ´¦Àí\ʵÑé\ʾÀýͼÏñ\Fig0306(a)(bone-scan).tif');

f1 = im2double(f);

h1 = fspecial('sobel'); % or directly type h=[-1 -2 -1;0 0 0;1 2 1];

g1 = imfilter(f1,h1);

subplot(121);imshow(f);

title('the original image');

%b1 = mat2gray(g1);

subplot(122);imshow(g1);

title('the Sobel gradient');

h2 = fspecial('average',5) ; %procducing a averageing filter

g2 = imfilter(g1,h2);

figure(2);

subplot(121);imshow(g2);

title(' the smoothed gradient image');

h3 = [-1 -1 -1; -1 8 -1;-1 -1 -1]; % Laplacian mask

g3 =imfilter(f1,h3);

%b2 = mat2gray(g3);

subplot(122);imshow(g3);

title('the Laplacian image');

g4 = g3+f1;

figure(3);

subplot(121);imshow(g4)

title('sharped image by adding laplacian filtered and original image');

g5 = g4.* g2;

subplot(122);imshow(g5);

title('the product of smoothed gradient and Laplacian image');

g6 = g5+f1;

figure(4);

subplot(121);imshow(g6);

title('the sum of product and original image');

% constrast spreading by power-law transformation with r=0.5 and c=1;

gamma = 0.5;

c = 1;

g7 = c.*g6.^gamma;

figure(4);

subplot(122);imshow(g7);

title('the end result by combining the sharping and gradient operation');

========================================================= =============

运行结果参考:

相关文档
最新文档