資源簡介
利用GVFSnake算法實現灰度圖像的邊緣檢測和圖像分割

代碼片段和文件信息
%?EXAMPLE?????GVF?snake?examples?on?two?simulated?object?boundaries.
%
%?NOTE:?
%?
%?traditional?snake?and?distance?snake?differed?from?GVF?snake?only?
%???by?using?different?external?force?field.?In?order?to?produce?the
%???corresponding?external?force?field?use?the?following?(all
%???assuming?edge?map?f?is?in?memory).
%
%?traditional?snake:
%???f0?=?gaussianBlur(f1);
%???[pxpy]?=?gradient(f0);
%
%?distance?snake:
%???D?=?dt(f>0.5);??%?distance?transform?(dt)?require?binary?edge?map
%???[pxpy]?=?gradient(-D);
%
%?[pxpy]?is?the?external?force?field?in?both?cases
%
%?balloon?model?using?a?different?matlab?function?“snakedeform2“
%?instead?of?“snakedeform“.?The?external?force?could?be?any?force
%?field?generated?above.
%
%?an?example?of?using?it?is?as?follows
%???????[xy]?=?snakedeform2(xy?alpha?beta?gamma?kappa?kappap?pxpy2);
%?do?a?“help?snakedeform2“?for?more?details
?
%???Chenyang?Xu?and?Jerry?Prince?6/17/97
%???Copyright?(c)?1996-97?by?Chenyang?Xu?and?Jerry?Prince
???cd?..;???s?=?cd;???s?=?[s?‘/snake‘];?path(s?path);?cd?examples;
???
???help?gvf_ex;
???%?====?Example?1:?U-shape?object?====
???%?Read?in?the?64x64?U-shape?image
?????[Imap]?=?rawread(‘../images/U64.pgm‘);??
?????
???%?Compute?its?edge?map
?????disp(‘?Compute?edge?map?...‘);
?????f?=?1?-?I/255;?
???%?Compute?the?GVF?of?the?edge?map?f
?????disp(‘?Compute?GVF?...‘);
?????[uv]?=?GVF(f?0.2?80);?
?????disp(‘?Nomalizing?the?GVF?external?force?...‘);
?????mag?=?sqrt(u.*u+v.*v);
?????px?=?u./(mag+1e-10);?py?=?v./(mag+1e-10);?
??%?display?the?results
?????figure(1);?
?????subplot(221);?imdisp(I);?title(‘test?image‘);
?????subplot(222);?imdisp(f);?title(‘edge?map‘);
?????%?display?the?gradient?of?the?edge?map
?????[fxfy]?=?gradient(f);?
?????subplot(223);?quiver(fxfy);?
?????axis?off;?axis?equal;?axis?‘ij‘;?????%?fix?the?axis?
?????title(‘edge?map?gradient‘);
?????%?display?the?GVF?
?????subplot(224);?quiver(pxpy);
?????axis?off;?axis?equal;?axis?‘ij‘;?????%?fix?the?axis?
?????title(‘normalized?GVF?field‘);
???%?snake?deformation
?????disp(‘?Press?any?key?to?start?GVF?snake?deformation‘);
?????pause;
?????subplot(221);
?????image(((1-f)+1)*40);?
?????axis(‘square‘?‘off‘);
?????colormap(gray(64));?
?????t?=?0:0.05:6.28;
?????x?=?32?+?30*cos(t);
?????y?=?32?+?30*sin(t);
?????[xy]?=?snakeinterp(xy31);?%?this?is?for?student?version
?????%?for?professional?version?use?
?????%???[xy]?=?snakeinterp(xy20.5);
?????snakedisp(xy‘r‘)?
?????pause(1);
?????for?i=1:25
???????[xy]?=?snakedeform(xy0.05010.6pxpy5);
???????[xy]?=?snakeinterp(xy31);?%?this?is?for?student?version
???????%?for?professional?version?use?
???????%???[xy]?=?snakeinterp(xy20.5);
???????snakedisp(xy‘r‘)?
???????title([‘Deformation?in?progress??iter?=?‘?num2str(i*5)])
???????pause(0.5);
???end
?????disp(‘?Press?any?key?to?display?the?final?result‘);
?????pause;
?????cla;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4963??1999-09-28?08:58??gvf_ex.m
????..AD...?????????0??2008-01-27?20:42??images
?????文件???????4109??1999-09-28?08:58??images\room.pgm
?????文件???????4109??1999-09-28?08:58??images\U64.pgm
?????文件????????298??1999-09-28?08:58??images\WS_FTP.LOG
????..AD...?????????0??2008-01-27?20:42??papers
?????文件????2073541??1999-09-28?08:58??papers\cvpr97.ps
?????文件????4148055??1999-09-28?08:58??papers\tip.ps
?????文件????????298??1999-09-28?08:58??papers\WS_FTP.LOG
????..AD...?????????0??2008-01-27?20:41??snake
?????文件????????916??1999-12-13?13:41??snake\BoundMirrorEnsure.m
?????文件????????699??1999-09-28?08:58??snake\BoundMirrorExpand.m
?????文件????????488??1999-09-28?08:58??snake\BoundMirrorShrink.m
?????文件???????1096??1999-09-28?08:58??snake\Contents.m
?????文件????????608??1999-09-28?08:58??snake\dt.m
?????文件????????500??1999-09-28?08:58??snake\gaussianBlur.m
?????文件????????255??1999-09-28?08:58??snake\gaussianMask.m
?????文件???????1637??1999-09-28?08:58??snake\GVF.m
?????文件????????252??1999-09-28?08:58??snake\imdisp.m
?????文件???????3256??1999-09-28?08:58??snake\rawread.m
?????文件???????1526??1999-09-28?08:58??snake\rawwrite.m
?????文件???????1501??1999-09-28?08:58??snake\snakedeform.m
?????文件???????1856??1999-09-28?08:58??snake\snakedeform2.m
?????文件????????551??1999-09-28?08:58??snake\snakedisp.m
?????文件????????190??1999-09-28?08:58??snake\snakeindex.m
?????文件????????894??1999-09-28?08:58??snake\snakeinit.m
?????文件???????1593??1999-09-28?08:58??snake\snakeinterp.m
?????文件???????1310??1999-09-28?08:58??snake\snakeinterp1.m
?????文件????????913??1999-09-28?08:58??snake\xconv2.m
?????目錄??????????0??2008-01-31?21:25??GVFSnake(matlab)
............此處省略34個文件信息
- 上一篇:波束形成Matlab程序218509
- 下一篇:map match matlab
評論
共有 條評論