• ningxiaocui
    了解作者
  • matlab
    开发工具
  • 34KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 3
    下载次数
  • 2017-09-06 09:18
    上传日期
几种不同的阈值分割方法的matlab实现方法
segment.rar
  • segment.docx
    36.4KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/6271a0b7c0b40515e3c031dd/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6271a0b7c0b40515e3c031dd/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">1.<span class="_ _0"> </span><span class="ff2 fs1">&#38408;&#20540;&#20998;&#21106;&#58885;&#58885;</span></div><div class="t m0 x1 h3 y3 ff1 fs0 fc1 sc0 ls0 ws0">2.<span class="_ _0"> </span><span class="ff3 fs1 fc0">1&#58882;<span class="fc2">/*===============================<span class="ff2">&#22270;&#20687;&#20998;&#21106;</span>============================</span></span></div><div class="t m0 x2 h4 y4 ff3 fs1 fc2 sc0 ls0 ws0">=========*/<span class="fc0">&#58882;&#58882;</span></div><div class="t m0 x1 h3 y5 ff1 fs0 fc0 sc0 ls0 ws0">3.<span class="_ _0"> </span><span class="ff3 fs1">2&#58882;<span class="fc2">/</span></span></div><div class="t m0 x2 h4 y6 ff3 fs1 fc2 sc0 ls0 ws0">*---------------------------------------------------------------------</div><div class="t m0 x2 h4 y7 ff3 fs1 fc2 sc0 ls0 ws0">------*/<span class="fc0">&#58882;&#58882;</span></div><div class="t m0 x1 h3 y8 ff1 fs0 fc1 sc0 ls0 ws0">4.<span class="_ _0"> </span><span class="ff3 fs1 fc0">3&#58882;<span class="fc2">/*<span class="ff2">&#25163;&#21160;&#35774;&#32622;&#38400;&#20540;</span>*/</span>&#58882;&#58882;</span></div><div class="t m0 x1 h3 y9 ff1 fs0 fc0 sc0 ls0 ws0">5.<span class="_ _0"> </span><span class="ff3 fs1">4&#58882;IplImage*&#58882;binaryImg&#58882;=&#58882;cvCreateImage(cvSize(w,&#58882;h),IPL_DEPTH_8U<span class="_ _1"></span>,&#58882;1);&#58882;&#58882;</span></div><div class="t m0 x1 h3 ya ff1 fs0 fc1 sc0 ls0 ws0">6.<span class="_ _0"> </span><span class="ff3 fs1 fc0">5&#58882;cvThreshold(smoothImgGauss,binaryImg,71,255,CV_THRESH_BIN<span class="_ _1"></span>ARY);&#58882;&#58882;&#58882;</span></div><div class="t m0 x1 h3 yb ff1 fs0 fc0 sc0 ls0 ws0">7.<span class="_ _0"> </span><span class="ff3 fs1">6&#58882;cvNamedWindow(<span class="fc3">"cvThreshold"</span>,&#58882;CV_WINDOW_AUTOSIZE&#58882;);&#58882;&#58882;</span></div><div class="t m0 x1 h3 yc ff1 fs0 fc1 sc0 ls0 ws0">8.<span class="_ _0"> </span><span class="ff3 fs1 fc0">7&#58882;cvShowImage(&#58882;<span class="fc3">"cvThreshold"</span>,&#58882;binaryImg&#58882;);&#58882;&#58882;</span></div><div class="t m0 x1 h3 yd ff1 fs0 fc0 sc0 ls0 ws0">9.<span class="_ _0"> </span><span class="ff3 fs1">8&#58882;<span class="fc2">//cvReleaseImage(&amp;binaryImg);&#58882;</span>&#58882;&#58882;</span></div><div class="t m0 x1 h3 ye ff1 fs0 fc1 sc0 ls0 ws0">10.<span class="_ _2"> </span><span class="ff3 fs1 fc0">9&#58882;&#58882;<span class="fc2">/</span></span></div><div class="t m0 x2 h4 yf ff3 fs1 fc2 sc0 ls0 ws0">*---------------------------------------------------------------------</div><div class="t m0 x2 h4 y10 ff3 fs1 fc2 sc0 ls0 ws0">------*/<span class="fc0">&#58882;&#58882;</span></div><div class="t m0 x1 h3 y11 ff1 fs0 fc0 sc0 ls0 ws0">11.<span class="_ _2"> </span><span class="ff3 fs1">10&#58882;<span class="fc2">/*<span class="ff2">&#33258;&#36866;&#24212;&#38400;&#20540;&#58885;</span>//<span class="ff2">&#35745;&#31639;&#20687;&#22495;&#37051;&#22495;&#30340;&#24179;&#22343;&#28784;&#24230;&#65292;&#26469;&#20915;&#23450;&#20108;&#20540;&#21270;&#30340;&#20540;</span>*/</span>&#58882;&#58882;</span></div><div class="t m0 x1 h3 y12 ff1 fs0 fc1 sc0 ls0 ws0">12.<span class="_ _2"> </span><span class="ff3 fs1 fc0">11&#58882;IplImage*&#58882;adThresImg&#58882;=&#58882;cvCreateImage(cvSize(w,&#58882;h),IPL_DEPTH_8U,&#58882;1);&#58882;</span></div><div class="t m0 x2 h4 y13 ff3 fs1 fc0 sc0 ls0 ws0">&#58882;</div><div class="t m0 x1 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">13.<span class="_ _2"> </span><span class="ff3 fs1">12&#58882;<span class="ff4 fc4">double</span>&#58882;max_value=255;&#58882;&#58882;</span></div><div class="t m0 x1 h3 y15 ff1 fs0 fc1 sc0 ls0 ws0">14.<span class="_ _2"> </span><span class="ff3 fs1 fc0">13&#58882;<span class="ff4 fc4">int</span>&#58882;adpative_method=CV_ADAPTIVE_THRESH_GAUSSIAN_C;<span class="fc2">//</span></span></div><div class="t m0 x2 h4 y16 ff3 fs1 fc2 sc0 ls0 ws0">CV_ADAPTIVE_THRESH_MEAN_C<span class="fc0">&#58882;&#58882;</span></div><div class="t m0 x1 h3 y17 ff1 fs0 fc0 sc0 ls0 ws0">15.<span class="_ _2"> </span><span class="ff3 fs1">14&#58882;&#58882;<span class="ff4 fc4">int</span>&#58882;threshold_type=CV_THRESH_BINARY;&#58882;&#58882;</span></div><div class="t m0 x1 h3 y18 ff1 fs0 fc1 sc0 ls0 ws0">16.<span class="_ _2"> </span><span class="ff3 fs1 fc0">15&#58882;<span class="ff4 fc4">int</span>&#58882;block_size=3;<span class="fc2">//<span class="ff2">&#38408;&#20540;&#30340;&#35937;&#32032;&#37051;&#22495;&#22823;&#23567;<span class="fc0">&#58885;&#58885;</span></span></span></span></div><div class="t m0 x1 h3 y19 ff1 fs0 fc0 sc0 ls0 ws0">17.<span class="_ _2"> </span><span class="ff3 fs1">16&#58882;&#58882;<span class="ff4 fc4">int</span>&#58882;offset=5;<span class="fc2">//<span class="ff2">&#31383;&#21475;&#23610;&#23544;<span class="fc0">&#58885;&#58885;</span></span></span></span></div><div class="t m0 x1 h3 y1a ff1 fs0 fc1 sc0 ls0 ws0">18.<span class="_ _2"> </span><span class="ff3 fs1 fc0">17&#58882;&#58882;&#58882;cvAdaptiveThreshold(smoothImgGauss,adThresImg,max_value,adpa<span class="_ _1"></span>tive_</span></div><div class="t m0 x2 h4 y1b ff3 fs1 fc0 sc0 ls0 ws0">method,threshold_type,block_size,offset);&#58882;&#58882;</div><div class="t m0 x1 h3 y1c ff1 fs0 fc0 sc0 ls0 ws0">19.<span class="_ _2"> </span><span class="ff3 fs1">18&#58882;cvNamedWindow(<span class="fc3">"cvAdaptiveThreshold"</span>,&#58882;CV_WINDOW_AUTOSIZE&#58882;);&#58882;&#58882;</span></div><div class="t m0 x1 h3 y1d ff1 fs0 fc1 sc0 ls0 ws0">20.<span class="_ _2"> </span><span class="ff3 fs1 fc0">19&#58882;cvShowImage(&#58882;<span class="fc3">"cvAdaptiveThreshold"</span>,&#58882;adThresImg&#58882;);&#58882;&#58882;</span></div><div class="t m0 x1 h3 y1e ff1 fs0 fc0 sc0 ls0 ws0">21.<span class="_ _2"> </span><span class="ff3 fs1">20&#58882;cvReleaseImage(&amp;adThresImg);&#58882;&#58882;</span></div><div class="t m0 x1 h3 y1f ff1 fs0 fc1 sc0 ls0 ws0">22.<span class="_ _2"> </span><span class="ff3 fs1 fc0">21&#58882;<span class="fc2">/</span></span></div><div class="t m0 x2 h4 y20 ff3 fs1 fc2 sc0 ls0 ws0">*---------------------------------------------------------------------</div><div class="t m0 x2 h4 y21 ff3 fs1 fc2 sc0 ls0 ws0">------*/<span class="fc0">&#58882;&#58882;</span></div><div class="t m0 x1 h3 y22 ff1 fs0 fc0 sc0 ls0 ws0">23.<span class="_ _2"> </span><span class="ff3 fs1">22&#58882;<span class="fc2">/*<span class="ff2">&#26368;&#22823;&#29109;&#38400;&#20540;&#20998;&#21106;&#27861;</span>*/</span>&#58882;&#58882;&#58882;</span></div><div class="t m0 x1 h3 y23 ff1 fs0 fc1 sc0 ls0 ws0">24.<span class="_ _2"> </span><span class="ff3 fs1 fc0">23&#58882;IplImage*&#58882;imgMaxEntropy&#58882;=&#58882;cvCreateImage(cvGetSize(imgGrey),<span class="_ _1"></span>IPL_DEPT</span></div><div class="t m0 x2 h4 y24 ff3 fs1 fc0 sc0 ls0 ws0">H_8U,1);&#58882;&#58882;</div><div class="t m0 x1 h3 y25 ff1 fs0 fc0 sc0 ls0 ws0">25.<span class="_ _2"> </span><span class="ff3 fs1">24&#58882;MaxEntropy(smoothImgGauss,imgMaxEntropy);&#58882;&#58882;</span></div><div class="t m0 x1 h3 y26 ff1 fs0 fc1 sc0 ls0 ws0">26.<span class="_ _2"> </span><span class="ff3 fs1 fc0">25&#58882;cvNamedWindow(<span class="fc3">"MaxEntroyThreshold"</span>,&#58882;CV_WINDOW_AUTOSIZE&#58882;);&#58882;&#58882;</span></div><div class="t m0 x1 h3 y27 ff1 fs0 fc0 sc0 ls0 ws0">27.<span class="_ _2"> </span><span class="ff3 fs1">26&#58882;cvShowImage(&#58882;<span class="fc3">"MaxEntroyThreshold"</span>,&#58882;imgMaxEntropy&#58882;);<span class="fc2">//<span class="ff2">&#26174;&#31034;&#22270;&#20687;<span class="fc0">&#58885;&#58885;</span></span></span></span></div><div class="t m0 x1 h3 y28 ff1 fs0 fc1 sc0 ls0 ws0">28.<span class="_ _2"> </span><span class="ff3 fs1 fc0">27&#58882;&#58882;&#58882;cvReleaseImage(&amp;imgMaxEntropy&#58882;);&#58882;&#58882;&#58882;</span></div><div class="t m0 x1 h3 y29 ff1 fs0 fc0 sc0 ls0 ws0">29.<span class="_ _2"> </span><span class="ff3 fs1">28&#58882;<span class="fc2">/</span></span></div><div class="t m0 x2 h4 y2a ff3 fs1 fc2 sc0 ls0 ws0">*---------------------------------------------------------------------</div><div class="t m0 x2 h4 y2b ff3 fs1 fc2 sc0 ls0 ws0">------*/<span class="fc0">&#58882;&#58882;</span></div><div class="t m0 x1 h3 y2c ff1 fs0 fc1 sc0 ls0 ws0">30.<span class="_ _2"> </span><span class="ff3 fs1 fc0">29&#58882;<span class="fc2">/*<span class="ff2">&#22522;&#26412;&#20840;&#23616;&#38400;&#20540;&#27861;</span>*/</span>&#58882;&#58882;</span></div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div> </body> </html>
评论
    相关推荐