声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1422|回复: 8

问个菜鸟问题:如果有源码,是不是输入EDIT窗口就能运行拉?

[复制链接]
发表于 2006-4-15 17:49 | 显示全部楼层 |阅读模式

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

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

x
<P>比如要弄个界面,读取图形,点按纽对他进行FCM处理,那是弄段代码输入EDIT,点运行就可以呢?还是要先做GUI界面,然后再在M里头输入代码呢?<BR>菜鸟请教</P>
回复
分享到:

使用道具 举报

发表于 2006-4-15 18:19 | 显示全部楼层
做个GUI界面,图像处理部分单独写个m文件进行计算
 楼主| 发表于 2006-4-15 18:29 | 显示全部楼层

回复:(zjliu)做个GUI界面,图像处理部分单独写个m文...

<DIV class=quote><B>以下是引用<I>zjliu</I>在2006-4-15 18:19:40的发言:</B><BR>做个GUI界面,图像处理部分单独写个m文件进行计算</DIV>
<P>是什么意思呢?是要用GUIDE做个界面~然后图象处理部分写M文件~那GUIDE自动生成的M文件怎搞?不是还要添回调函数啥的吗?<BR>糊涂了~</P>
发表于 2006-4-15 18:39 | 显示全部楼层
图像处理部分单独写到一个m文件里面,然后在GUI的callback里面调用<BR>这个函数进行图像处理
 楼主| 发表于 2006-4-15 18:44 | 显示全部楼层
恩~貌似懂了~再请教下<BR>我做的是基与FCM模糊聚类的图象分割~搞了个源码~那这个是要单独写进M文件的的吗?就是说我还要再做个界面?<BR>整个代码如下:<BR>function fcmapp(file, cluster_n)<BR>% FCMAPP<BR>% fcmapp(file, cluter_n) segments a image named file using the algorithm<BR>% FCM.<BR>% [in]<BR>%   file: the path of the image to be clustered.<BR>%   cluster_n: the number of cluster for FCM.
<P>eval(['info=imfinfo(''',file, ''');']);<BR>switch info.ColorType<BR>    case 'truecolor'<BR>        eval(['RGB=imread(''',file, ''');']);<BR>%       [X, map] = rgb2ind(RGB, 256);<BR>        I = rgb2gray(RGB);<BR>        clear RGB;<BR>    case 'indexed'<BR>        eval(['[X, map]=imread(''',file, ''');']);<BR>        I = ind2gray(X, map);<BR>        clear X;<BR>    case 'grayscale'<BR>        eval(['I=imread(''',file, ''');']);<BR>end;<BR>I = im2double(I);<BR>filename = file(1 : find(file=='.')-1);<BR>data = reshape(I, numel(I), 1);</P>
<P>tic<BR>[center, U, obj_fcn]=fcm(data, cluster_n);<BR>elapsedtime = toc;</P>
<P>%eval(['save(', filename, int2str(cluster_n),'.mat'', ''center'', ''U'', ''obj_fcn'', ''elapsedtime'');']);<BR>fprintf('elapsedtime = %d', elapsedtime);</P>
<P>maxU=max(U);<BR>temp = sort(center, 'ascend');<BR>for n = 1:cluster_n;<BR>    eval(['cluster',int2str(n), '_index = find(U(', int2str(n), ',:) == maxU);']);<BR>    index = find(temp == center(n));<BR>    switch index<BR>        case 1<BR>            color_class = 0;<BR>        case cluster_n<BR>            color_class = 255;<BR>        otherwise<BR>            color_class = fix(255*(index-1)/(cluster_n-1));<BR>    end<BR>    eval(['I(cluster',int2str(n), '_index(:))=', int2str(color_class),';']);<BR>end;<BR>filename = file(1:find(file=='.')-1);<BR>I = mat2gray(I);<BR>%eval(['imwrite(I,', filename,'_seg', int2str(cluster_n), '.bmp'');']);<BR>imwrite(I, 'temp\tu2_4.bmp');<BR>imview(I);</P>
 楼主| 发表于 2006-4-15 18:45 | 显示全部楼层
不好意思~代码有点长~错误提示:<BR>Error in ==&gt; fcmapp at 9<BR>eval(['info=imfinfo(''',file, ''');']);<BR>而且单独放EDIT里头运行会报错
发表于 2006-4-15 18:47 | 显示全部楼层
这个我已回复,你看看前面的帖子
 楼主| 发表于 2006-4-15 19:24 | 显示全部楼层
<P>eval(['info=imfinfo(''',file, ''');']);<BR>请问怎么改啊?</P>
发表于 2006-6-6 10:09 | 显示全部楼层

回复:(菜肉包子)问个菜鸟问题:如果有源码,是不是输...

我正在找FCM源码,楼主能发一份给我吗?<br>邮箱:rick3360662@sohu.com<br>谢谢~<br>
[此贴子已经被作者于2006-6-6 10:09:51编辑过]

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

本版积分规则

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

GMT+8, 2024-9-23 01:30 , Processed in 0.058898 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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