% test6_4.m % 顶帽、底帽分割,分水岭分割 clear; close all; clc; I=imread('rice.tif'); figure; subplot(221); imshow(I); title('原图'); se = strel('disk', 15) ; Itop = imtophat (I,se) ; subplot(222); imshow(Itop,[ ]); title ('顶帽imtophat'); Ibot = imbothat(I,se) ; subplot(224); imshow(Ibot,[ ]); title ('底帽imbothat'); Ienhance = imsubtract(imadd (Itop,I),Ibot) ; subplot(223); imshow(Ienhance); title ('原始+顶帽-底帽'); figure; subplot(221); imshow(Ienhance); title ('原始+顶帽-底帽'); Iec = imcomplement( Ienhance) ; subplot(222); imshow(Iec); title ('反色图像,互补图像imcomplement'); Iemin = imextendedmin( Iec , 22) ; subplot(223); imshow(Iemin); title ('扩展极小变换imextendedmin'); Iimpose = imimposemin ( Iec , Iemin) ; subplot(224); imshow(Iimpose); title ( '强加最小值imimposemin'); BW = watershed(Iimpose); figure('Name','分水岭'); subplot(121); imshow(BW); title ( '分水岭watershed'); B=BW==0; subplot(122); imshow(B); title ( '分水岭边界'); 修改程序,将原始图像与分水岭边界图像叠加并显示,
理解问题% test6_4.m % 顶帽、底帽分割,分水岭分割 clear; close all; clc; I=imread('rice.tif'); figure; subplot(221); imshow(I); title('原图'); se = strel('disk', 15) ; Itop = imtophat (I,se) ; subplot(222); imshow(Itop,[ ]); title ('顶帽imtophat'); Ibot = imbothat(I,se) ; subplot(224); imshow(Ibot,[ ]); title ('底帽imbothat'); Ienhance = imsubtract(imadd (Itop,I),Ibot) ; subplot(223); imshow(Ienhance); title ('原始+顶帽-底帽'); figure; subplot(221); imshow(Ienhance); title ('原始+顶帽-底帽'); Iec = imcomplement( Ienhance) ; subplot(222); imshow(Iec); title ('反色图像,互补图像imcomplement'); Iemin = imextendedmin( Iec , 22) ; subplot(223); imshow(Iemin); title ('扩展极小变换imextendedmin'); Iimpose = imimposemin ( Iec , Iemin) ; subplot(224); imshow(Iimpose); title ( '强加最小值imimposemin'); BW = watershed(Iimpose); figure('Name','分水岭'); subplot(121); imshow(BW); title ( '分水岭watershed'); B=BW==0; subplot(122); imshow(B); title ( '分水岭边界'); 修改程序,将原始图像与分水岭边界图像叠加并显示,
已完成理解「% test6_4.m % 顶帽、底帽分割,分水岭分割 clear; close all; clc; I=imread('rice.tif'); figure; subplot(221); imshow(I); title('原图'); se = strel('disk', 15) ; Itop = imtophat (I,se) ; subplot(222); imshow(Itop,[ ]); title ('顶帽imtophat'); Ibot = imbothat(I,se) ; subplot(224); imshow(Ibot,[ ]); title ('底帽imbothat'); Ienhance = imsubtract(imadd (Itop,I),Ibot) ; subplot(223); imshow(Ienhance); title ('原始+顶帽-底帽'); figure; subplot(221); imshow(Ienhance); title ('原始+顶帽-底帽'); Iec = imcomplement( Ienhance) ; subplot(222); imshow(Iec); title ('反色图像,互补图像imcomplement'); Iemin = imextendedmin( Iec , 22) ; subplot(223); imshow(Iemin); title ('扩展极小变换imextendedmin'); Iimpose = imimposemin ( Iec , Iemin) ; subplot(224); imshow(Iimpose); title ( '强加最小值imimposemin'); BW = watershed(Iimpose); figure('Name','分水岭'); subplot(121); imshow(BW); title ( '分水岭watershed'); B=BW==0; subplot(122); imshow(B); title ( '分水岭边界'); 修改程序,将原始图像与分水岭边界图像叠加并显示,」
展开阅读网页