matlab canny算子边缘检测函数代码

 我来答
欣零零落落啦啦
2018-04-05 · TA获得超过4296个赞
知道小有建树答主
回答量:29
采纳率:0%
帮助的人:8.3万
展开全部

I = imread('lena.bmp');                 %%如果是其他类型图像,请先转换为灰度图 

%%没有噪声时的检测结果 

BW_sobel = edge(I,'sobel');

BW_prewitt = edge(I,'prewitt'); 

BW_roberts = edge(I,'roberts'); 

BW_laplace = edge(I,'log');

BW_canny = edge(I,'canny'); figure(1); 

subplot(2,3,1),imshow(I),xlabel('原始图像'); 

subplot(2,3,2),imshow(BW_sobel),xlabel('sobel检测');

subplot(2,3,3),imshow(BW_prewitt),xlabel('prewitt检测'); 

subplot(2,3,4),imshow(BW_roberts),xlabel('roberts检测'); 

subplot(2,3,5),imshow(BW_laplace),xlabel('laplace检测');

subplot(2,3,6),imshow(BW_canny),xlabel('canny检测'); 

%%加入高斯噪声(μ=0,σ^2=0.01)检测结果

I_g1 = imnoise(I,'gaussian',0,0.01);

BW_sobel = edge(I_g1,'sobel'); 

BW_prewitt = edge(I_g1,'prewitt'); 

BW_roberts = edge(I_g1,'roberts'); 

BW_laplace = edge(I_g1,'log'); 

BW_canny = edge(I_g1,'canny'); figure(2); 

subplot(2,3,1),imshow(I_g1),xlabel('加入高斯噪声(μ=0,σ^2=0.01)图像');

subplot(2,3,2),imshow(BW_sobel),xlabel('sobel检测'); 

subplot(2,3,3),imshow(BW_prewitt),xlabel('prewitt检测'); 

subplot(2,3,4),imshow(BW_roberts),xlabel('roberts检测'); 

subplot(2,3,5),imshow(BW_laplace),xlabel('laplace检测'); 

subplot(2,3,6),imshow(BW_canny),xlabel('canny检测');  

%%加入高斯噪声(μ=0,σ^2=0.02)检测结果

I_g2 = imnoise(I,'gaussian',0,0.02); 

BW_sobel = edge(I_g2,'sobel');

BW_prewitt = edge(I_g2,'prewitt'); 

BW_roberts = edge(I_g2,'roberts'); 

BW_laplace = edge(I_g2,'log');

BW_canny = edge(I_g2,'canny'); figure(3); 

subplot(2,3,1),imshow(I_g2),xlabel('加入高斯噪声(μ=0,σ^2=0.02)图像');

subplot(2,3,2),imshow(BW_sobel),xlabel('sobel检测');

subplot(2,3,3),imshow(BW_prewitt),xlabel('prewitt检测'); 

subplot(2,3,4),imshow(BW_roberts),xlabel('roberts检测'); 

subplot(2,3,5),imshow(BW_laplace),xlabel('laplace检测');

subplot(2,3,6),imshow(BW_canny),xlabel('c

一、没有噪声时的检测结果 1 原始图像 

2 Sobel算子边缘检测 3 Prewitt算子边缘检测 4 Roberts算子边缘检测 5 Laplace算子边缘检测 6 Canny算子边缘检测 

二、加入高斯噪声(μ=0,σ^2=0.01)检测结果 1 原始图像 

2 Sobel算子边缘检测 3 Prewitt算子边缘检测 4 Roberts算子边缘检测 5 Laplace算子边缘检测 6 Canny算子边缘检测  

三、加入高斯噪声(μ=0,σ^2=0.02)检测结果 1 原始图像 

2 Sobel算子边缘检测 3 Prewitt算子边缘检测 4 Roberts算子边缘检测 5 Laplace算子边缘检测 6 Canny算子边缘检测   

clear all; close all; 

warning off all;

本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
光点科技
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件... 点击进入详情页
本回答由光点科技提供
百度网友23cba28
推荐于2018-02-27
知道答主
回答量:15
采纳率:0%
帮助的人:7.1万
展开全部
clc
clear all
close all
I = imread('cameraman.tif'); % 读入图像
imshow(I);title('原图')
BW1 = edge(I,'canny'); % 调用canny函数
figure,imshow(BW1); % 显示分割后的图像,即梯度图像
title('Canny')
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
英雄创业精神奇
2011-06-01 · TA获得超过1601个赞
知道小有建树答主
回答量:1454
采纳率:0%
帮助的人:1486万
展开全部
这个指的是c源代码数据包
还是简单的 I = imread(''); BW = edge(I,'canny');
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式