实验4图像分割及边缘检测.doc
文本预览下载声明
实验4 图像分割及边缘检测
应电101黎杰良201036626115
一、实验目的:
理解图像分割和边缘检测的概念,利用Matlab图像处理函数实现图像的分割,并实现边缘的提取。
二、实验内容:
1、学习并应用阈值分割im2bw函数, 利用直方图来选取阈值,对已知图像进行二值化分割。
2、学习用常见的Roberts算子、Sobel算子、Prewitt算子、Laplacian算子、Canny算子等微分算子检测图像边缘
三、实验要求:提交原图像和各种直方图曲线,以及按直方图处理后的图像。
四、实验步骤
阈值分割
阅读im2bw ,imhist的帮助文件;
help im2bw
IM2BW Convert image to binary image by thresholding.
IM2BW produces binary images from……………
Example
-------
load trees
BW = im2bw(X,map,0.4);
imshow(X,map), figure, imshow(BW)
See also GRAYTHRESH, IND2GRAY, RGB2GRAY.
help imhist
IMHIST Display histogram of image data.
IMHIST(I) displays a histogram for…………
Example
-------
I = imread(pout.tif);
imhist(I)
See also HISTEQ, HIST.
读入一幅图像,使用imhist( )函数产生图像的直方图,分析它的直方图分布,选取分割的阈值;选取阀值T=160/255
用 HYPERLINK file:///J:\\teaching\\2012-2013-1%20数字图像处理_应电\\教学文档\\I=imread(J:\\work\\car.jpg);%0d%0asubplot(1,2,1);imshow(I);title(真彩图)%0d%0aI2=im2bw(I)%0d%0asubplot(1,2,2);imshow(I2);title(二值图) \t _parent BW=im2bw(I,T)函数,实现阈值分割。选取阀值T=160/255
边缘检测
阅读 HYPERLINK file:///J:\\teaching\\2012-2013-1%20数字图像处理_应电\\教学文档\\W%20=%20EDGE(I,sobel) \t _parent edge的帮助文件;
help edge
EDGE Find edges in intensity image.
EDGE takes an intensity or a binary image I as its input, and ………
Example
-------
Find the edges of the rice.tif image using the Prewitt and Canny
methods:
I = imread(rice.tif);
BW1 = edge(I,prewitt);
BW2 = edge(I,canny);
imshow(BW1)
figure, imshow(BW2)
See also FSPECIAL.
用 HYPERLINK file:///J:\\teaching\\2012-2013-1%20数字图像处理_应电\\??学文档\\I=imread(J:\\work\\car.jpg);%0d%0asubplot(1,2,1);imshow(I);title(真彩图)%0d%0aI2=im2bw(I)%0d%0asubplot(1,2,2);imshow(I2);title(二值图) \t _parent BW=edge(I,methold)函数,实现图像的边缘检测;
比较不同算子的边缘检测效果。
显示全部