形态学处理MATLAB函数简介
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
8 举例:用图像分割检测细胞
步骤1:读入图像 I = imread('cell.tif'); figure, imshow(I) title('original image')
8 举例:用图像分割检测细胞
步骤2:边缘检测 BWs = edge(I, 'sobel', (graythresh(I) * .1)); figure imshow(BWs) title('binary gradient mask')
8 举例:用图像分割检测细胞
Step Step Step Step Step Step Read Image Detect Entire Cell Fill Gaps Dilate the Image Fill Interior Gaps Remove Connected Objects on Border Step 7: Smooth the Object 1: 2: 3: 4: 5: 6:
I = imread('cameraman.tif'); se = strel('ball',5,5); I2 = imdilate(I,se); imshow(I), title('Original') figure, imshow(I2), title('Dilated')
4 图像开运算函数
imopen Open an image Syntax IM2 = imopen(IM,SE) IM2 = imopen(IM,NHOOD)
2 图像腐蚀函数
imerode Erode image Syntax IM2 = imerode(IM,SE) IM2 = imerode(IM,NHOOD) IM2 = imerode(IM,SE,PACKOPT,M) IM2 = imerode(...,PADOPT)
2 图像腐蚀函数
originalBW = imread('circles.png'); se = strel('disk',11); erodedBW = imerode(originalBW,se); imview(originalBW) imview(erodedBW)
7 图像填充函数
imfill Fill image regions Syntax BW2 = imfill(BW,locations) BW2 = imfill(BW,'holes') I2 = imfill(I) BW2 = imfill(BW) [BW2 locations] = imfill(BW) BW2 = imfill(BW,locations,CONN) BW2 = imfill(BW,CONN,'holes') I2 = imfill(I,CONN)
1 结构元素创建函数
SE = strel('disk',R,N) creates a flat, disk-shaped structuring element, where R specifies the radius
1 结构元素创建函数
SE = strel('line',LEN,DEG) creates a flat, linear structuring element, where LEN specifies the length, and DEG specifies the angle (in degrees) of the line
图像形态学处理函数简介
1 结构元素创建函数
strel Create morphological structuring element Syntax SE = strel(shape,parameters) Description SE = strel(shape,parameters) creates a structuring element, SE, of the type specified by shape. This table lists all the supported shapes. Depending on shape, strel can take additional parameters. See the syntax descriptions that follow for details about creating each type of structuring element
8 举例:用图像分割检测细胞
步骤5: 填充内部空洞 BWdfill = imfill(BWsdil, 'holes'); figure, imshow(BWdfill); title('binary image with filled holes');
8 举例:用图像分割检测细胞
步骤6:消除与边界相连的目标 BWnobord = imclearborder(BWdfill, 4); figure, imshow(BWnobord), title('cleared border image')
1 结构元素创建函数
SE = strel('diamond',R) creates a flat, diamond-shaped structuring element, where R specifies the distance from the structuring element origin to the points of the diamond.
8 举例:用图像分割检测细胞
步骤7:平滑目标边界 seD = strel('diamond',1); BWfinal = imerode(BWnobord,seD); BWfinal = imerode(BWfinal,seD); figure, imshow(BWfinal), title('segmented image')
5 图像闭运算函数
imclose Close an image Syntax IM2 = imclose(IM,SE) IM2 = imclose(IM,NHOOD)
6 边界消除函数
imclearborder Suppress light structures connected to image border Syntax IM2 = imclearborder(IM) IM2 = imclearborder(IM,CONN) Description suppresses structures that are lighter than their surroundings and that are connected to the image border.
7 图像填充函数
Fill in the holes of a binary image. BW4 = im2bw(imread('coins.png')); BW5 = imfill(BW4,'holes'); imview(BW4), imview(BW5)
7 图像填充函数
Fill in the holes of an intensity image. I = imread('tire.tif'); I2 = imfill(I,'holes'); imview(I), imview(I2)
1 结构元素创建函数
1 结构元素创建函数
SE = strel('arbitraryห้องสมุดไป่ตู้,NHOOD) creates a flat structuring element where NHOOD specifies the neighborhood. floor((size(NHOOD)+1)/2)
8 举例:用图像分割检测细胞
步骤3:创建结构元素 se90 = strel('line', 3, 90); se0 = strel('line', 3, 0); 步骤4;膨胀图像 BWsdil = imdilate(BWs, [se90 se0]); figure, imshow(BWsdil) title('dilated gradient mask')
3 图像膨胀函数
imdilate Dilate image Syntax IM2 = imdilate(IM,SE) IM2 = imdilate(IM,NHOOD) IM2 = imdilate(IM,SE,PACKOPT) IM2 = imdilate(...,PADOPT)
3 图像膨胀函数
1 结构元素创建函数
SE = strel('pair',OFFSET) creates a flat structuring element containing two members. One member is located at the origin. The second member's location is specified by the vector OFFSET.