yijing123456 发表于 2008-4-18 09:32

求图形边界完整程序

小弟因为做一个比赛项目的需要,要用matlab求三维实体的二维显示图边界并显示出来,希望哪位大侠可以帮忙给出完整的程序,感激不尽!
原图请见附件:

eight 发表于 2008-4-18 10:33

原帖由 yijing123456 于 2008-4-18 09:32 发表 http://www.chinavib.com/forum/images/common/back.gif
小弟因为做一个比赛项目的需要,要用matlab求三维实体的二维显示图边界并显示出来,希望哪位大侠可以帮忙给出完整的程序,感激不尽!
原图请见附件: 建议多看看置顶的会员守则,指望别人给你程序根本不现实

sogooda 发表于 2008-4-18 15:38

不推荐求完整程序的方式,一来是可能性很小,二来是一旦求到了很可能就得过且过了,对自己的学习不好。
碰巧我手上有这么个程序,你可以参考一下,应该有帮助。% 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,); %Median filtering the image to remove noise%
BW = edge(im1,'sobel'); %finding edges
=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)); %Smoothingimage 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.
= find(L==17);
rc = ;
=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,[]);

[ 本帖最后由 sogooda 于 2008-4-18 15:39 编辑 ]
页: [1]
查看完整版本: 求图形边界完整程序