資源簡介
利用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
- 上一篇:蟻群算法的特征選取 matlab實現
- 下一篇:matlab 2015a許可文件
評論
共有 條評論