• 大小: 6KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: Matlab
  • 标签: 图像处理  

资源简介

利用Matlab处理图像,使用几种方法进行边缘分割

资源截图

代码片段和文件信息


clc;
clear;

x=imread(‘zx.bmp‘);
gray=rgb2gray(x);
figure;
imshow(x);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
figure;
imshow(gray[]);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);



gray_x=gray;


BW_sobel=edge(gray_x‘sobel‘0.07);
figure;
imshow(BW_sobel);
title(‘sobel‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);

BW_sobel=edge(gray_x‘sobel‘0.05);
figure;
imshow(BW_sobel);
title(‘sobel‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);

BW_sobel=edge(gray_x‘sobel‘0.03);
figure;
imshow(BW_sobel);
title(‘sobel‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);

BW_sobel=edge(gray_x‘sobel‘0);
figure;
imshow(BW_sobel);
title(‘sobel‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);







BW_prewitt=edge(gray_x‘prewitt‘);
BW_roberts=edge(gray_x‘roberts‘);
figure;
imshow(BW_sobel);
title(‘sobel‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);
figure;
imshow(BW_prewitt);
title(‘prewitt‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);
figure;
imshow(BW_roberts);
title(‘roberts‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);

BW_log_0=edge(gray_x‘log‘);
figure;
imshow(BW_log_0);
title(‘log []‘);
axis on;
xlabel(‘x/像素‘);
ylabel(‘y/像素‘);
set(findall(gcf‘type‘‘surface‘)‘facealpha‘0.4)
uimenufcn(gcf‘EditCopyFigure‘)
set(gcf‘unit‘‘centimeters‘‘position‘[3 5 8 6])
set(gca‘Position‘[.2 .2 .7 .65]);
BW_log_0=edge

评论

共有 条评论