Peng Lv

毋意,毋必,毋固,毋我。 言必行,行必果。

导航

随笔分类 -  Matlab

{matlab}取二值图像centroid几种方法性能比较
摘要:试验很简单,取二值图像的质心,三种方法做比较1.完全采用矩阵性能不做任何循环操作,对find后的值进行除法与取余操作,从而得到centroid2.完全采用循环操作,最简单明了3.结合1,2,对每一列进行find,省去与除法与取余的计算时间分析试验证明矩阵小的情况下,2是最优的,1与3差不多是2的三倍矩阵中大情况下,三种方法时间一样当处理大矩阵时,方法3具有明显的优势,1,2差不多是3的两倍倍时间所以我采用了方法2,简单明了,效率也可以。测试代码M = 9000;N = 1700;A = randn(M,N);A = A>0.0;%%%%%%%%%%%%%%%%%%%% 方法1 %%%%% 阅读全文

posted @ 2013-12-18 22:00 Lvpengms 阅读(2907) 评论(0) 推荐(0)

{vlFeat}{Matlab}Linux中matlab的vlFeat配置
摘要:1.下载vlFeat编译后的版本binary package2.解压后将 toolbox/,bin/,data/ 等文件夹复制到matlab新建工具箱目录 /toolbox/vlfeat/ 中3.向matlab的 /usr/local/matlab/R2010b/toolbox/local/pathdef.m 文件中添加vlfeat路径:matlabroot,'/toolbox/vlfeat/toolbox;', ...matlabroot,'/toolbox/vlfeat/toolbox/aib;', ...matlabroot,'/toolbox/v 阅读全文

posted @ 2013-12-17 14:46 Lvpengms 阅读(1296) 评论(0) 推荐(0)

{vlFeat}{matlab}{VS2010}{编译配置}
摘要:运行程序需要vlfeat与mex等在matlab与vs2010中配置,碰到了不少困难,下面给出解决方案1.下载vlfeat,但是vlfeat目录中并没有编译好的mex文件,需要在vs2010中编译修改 ARCH=win64 为 ARCH=win32修改makefile.mak文件中的路径,把vc++与matlab的路径全部修改为本机的路径重新rebuild2.在matlab中配置vlfeat找到目录,vlfeat/toolbox/,运行vl_compile.m运行vl_setup.m,即可在matlab中配置vlfeat 阅读全文

posted @ 2013-11-12 13:20 Lvpengms 阅读(1469) 评论(0) 推荐(0)

{matlab}{计时函数}cputime
摘要:putime 显示Matlab启动后所占用的CPU时间;tic,toc 秒表计时,tic是开始,toc是结束;clock,etime 前者显示系统时间,后者计算两次调用clock之间的时间差。eg:1 t0 = cputime; 你的程序;time=cputime-t0;2 tic; 你的程序;toc;3 t0 = clock;你的程序;time = etime(clock, t0); 阅读全文

posted @ 2013-11-05 00:45 Lvpengms 阅读(2358) 评论(0) 推荐(0)

Vim's Setting for Editing Matlab Files
摘要:You should install a plugin named {editing Matlab files in Vim}.Then add such command to your own .vimrc filesource $VIMRUNTIME/macros/matchit.vimfiletype indent onautocmd BufEnter *.m compiler mlint 阅读全文

posted @ 2012-05-28 16:58 Lvpengms 阅读(755) 评论(0) 推荐(0)

[Keep Updating] Matlab Notes
摘要:# select a rectangle from an frame[l r t b ] = select(iFrame);# import data from a data fileinfo = importdata('info.txt')# Read image to a Cell structfor i = 1:N F{i} = imread(img_i);end# Create an struct/classst = struct('name','lp','id',7,'age',22);# use a f 阅读全文

posted @ 2012-05-23 15:50 Lvpengms 阅读(287) 评论(0) 推荐(0)