声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 867|回复: 2

[综合讨论] 求图形边界完整程序

[复制链接]
发表于 2008-4-18 09:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

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

使用道具 举报

发表于 2008-4-18 10:33 | 显示全部楼层
原帖由 yijing123456 于 2008-4-18 09:32 发表
小弟因为做一个比赛项目的需要,要用matlab求三维实体的二维显示图边界并显示出来,希望哪位大侠可以帮忙给出完整的程序,感激不尽!
原图请见附件:
建议多看看置顶的会员守则,指望别人给你程序根本不现实
发表于 2008-4-18 15:38 | 显示全部楼层
不推荐求完整程序的方式,一来是可能性很小,二来是一旦求到了很可能就得过且过了,对自己的学习不好。
碰巧我手上有这么个程序,你可以参考一下,应该有帮助。
  1. % This is a program for extracting objects from an image. Written for vehicle number plate segmentation and extraction
  2. % Authors : Jeny Rajan, Chandrashekar P S
  3. % U can use attached test image for testing
  4. % input - give the image file name as input. eg :- car3.jpg
  5. clc;
  6. clear all;
  7. k=input('Enter the file name','s'); % input image; color image
  8. im=imread(k);
  9. im1=rgb2gray(im);
  10. im1=medfilt2(im1,[3 3]); %Median filtering the image to remove noise%
  11. BW = edge(im1,'sobel'); %finding edges
  12. [imx,imy]=size(BW);
  13. msk=[0 0 0 0 0;
  14.      0 1 1 1 0;
  15.      0 1 1 1 0;
  16.      0 1 1 1 0;
  17.      0 0 0 0 0;];
  18. B=conv2(double(BW),double(msk)); %Smoothing  image to reduce the number of connected components
  19. L = bwlabel(B,8);% Calculating connected components
  20. mx=max(max(L))
  21. % 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
  22. % 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.
  23. [r,c] = find(L==17);  
  24. rc = [r c];
  25. [sx sy]=size(rc);
  26. n1=zeros(imx,imy);
  27. for i=1:sx
  28.     x1=rc(i,1);
  29.     y1=rc(i,2);
  30.     n1(x1,y1)=255;
  31. end % Storing the extracted image in an array
  32. figure,imshow(im);
  33. figure,imshow(im1);
  34. figure,imshow(B);
  35. figure,imshow(n1,[]);
复制代码

[ 本帖最后由 sogooda 于 2008-4-18 15:39 编辑 ]
car3.jpg

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-23 13:29 , Processed in 0.071800 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表