跪求matlab程序代码 关于医学图像分割处理 边缘检测 阈值法

 我来答
xpeng_001
2011-05-11
知道答主
回答量:12
采纳率:100%
帮助的人:10.7万
展开全部
图像分割程序:
% This is a program for extracting objects from an image. Written for vehicle number plate segmentation and extraction
% Authors : Jeny Rajan, Chandrashekar P S
% U can use attached test image for testing
% input - give the image file name as input. eg :- car3.jpg
clc;
clear all;
k=input('Enter the file name','s'); % input image; color image
im=imread(k);
im1=rgb2gray(im);
im1=medfilt2(im1,[3 3]); %Median filtering the image to remove noise%
BW = edge(im1,'sobel'); %finding edges
[imx,imy]=size(BW);
msk=[0 0 0 0 0;
0 1 1 1 0;
0 1 1 1 0;
0 1 1 1 0;
0 0 0 0 0;];
B=conv2(double(BW),double(msk)); %Smoothing image to reduce the number of connected components
L = bwlabel(B,8);% Calculating connected components
mx=max(max(L))
% There will be mx connected components.Here U can give a value between 1 and mx for L or in a loop you can extract all connected components
% If you are using the attached car image, by giving 17,18,19,22,27,28 to L you can extract the number plate completely.
[r,c] = find(L==17);
rc = [r c];
[sx sy]=size(rc);
n1=zeros(imx,imy);
for i=1:sx
x1=rc(i,1);
y1=rc(i,2);
n1(x1,y1)=255;
end % Storing the extracted image in an array
figure,imshow(im);
figure,imshow(im1);
figure,imshow(B);
figure,imshow(n1,[]);

边缘检测:
I=imread('lena.jpg');
imshow(I);
title('原始图像');
BW1= edge(I,'Canny',0.00) ; %edge调用Canny为检测算子判别阈值为0.00
figure,imshow(BW1);
title( '阈值为0.00的Canny算子边缘检测图像 ');
BW2= edge(I,'Canny',0.05) ; %edge调用Canny为检测算子判别阈值为0.05
figure,imshow(BW2);
title( '阈值为0.05的Canny算子边缘检测图像');
BW20= edge(I,'Canny',0.1) ; %edge调用Canny为检测算子判别阈值为0.1
figure,imshow(BW20);
title( '阈值为0.1的Canny算子边缘检测图像');
BW21= edge(I,'Canny',0.2) ; %edge调用Canny为检测算子判别阈值为0.2
figure,imshow(BW21);
title( '阈值为0.2的Canny算子边缘检测图像 ');
BW22= edge(I,'Canny',0.3) ; %edge调用Canny为检测算子判别阈值为0.3
figure,imshow(BW22);
title( '阈值为0.3的Canny算子边缘检测图像 ');
光点科技
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件... 点击进入详情页
本回答由光点科技提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式