clc
close all
clear all
% I=imread('oil_3.jpg');
% I1=im2double(I);%将彩色序列转化为双精度
% I2=rgb2gray(I1);%将彩色图变成灰色图
load J
I=J;
I2=J;
se=strel('disk',15);
Itop=imtophat(I2,se);
Ibot=imbothat(I2,se);
Ienhance=imsubtract(imadd(Itop,I2),Ibot);
Iec=imcomplement(Ienhance);
Iemin=imextendedmin(Iec,0.35);
Iimpose=imimposemin(Iec,Iemin);
wat=watershed(Iimpose);
rgb=label2rgb(wat);
rgb=rgb2gray(rgb);
figure;
subplot(3,3,1);imshow(I),title('原图');
subplot(3,3,2);imshow(I2),title('灰色图');
subplot(3,3,3);imshow(Itop,[]),title('高帽变换');
subplot(3,3,4);imshow(Ibot,[]),title('低帽变换');
subplot(3,3,5);imshow(Ienhance),title('增强图');
subplot(3,3,6);imshow(Iec),title('增强图的补图');
subplot(3,3,7);imshow(Iemin),title('二值图');
subplot(3,3,8);imshow(Iimpose),title('强化低谷图');
subplot(3,3,9);imshow(rgb),title('分水岭');
program.rar_site:www.pudn.com
版权申诉
96 浏览量
2022-07-15
04:27:42
上传
评论
收藏 536B RAR 举报
局外狗
- 粉丝: 67
- 资源: 1万+