image_8cpp-source.html

来自「显著区域检测。求的图像中感兴趣区域的位置」· HTML 代码 · 共 251 行 · 第 1/3 页

HTML
251 行
字号
<a name="l00067"></a>00067 <span class="comment">// ######################################################################</span><a name="l00068"></a><a class="code" href="classImage.html#1cd7587f88b6932b5269051d1ba08ff9">00068</a> <span class="keywordtype">int</span> <a class="code" href="classImage.html#1cd7587f88b6932b5269051d1ba08ff9" title="Returns the height of the Image.">Image::getHeight</a>()<span class="keyword"> const</span><a name="l00069"></a>00069 <span class="keyword"></span>{<a name="l00070"></a>00070   <a class="code" href="mexLog_8h.html#092bd7bb2cb7fd9f483b6995cee61bc0">ASSERT</a>(<a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335" title="Returns whether the Image is initialized.">isInitialized</a>());<a name="l00071"></a>00071   <span class="keywordflow">return</span> mxGetM(<a class="code" href="classImage.html#35612d5fc9961d1096fcafbccabe5d0e" title="Returns a constant pointer to the underlying Matlab array.">getConstArray</a>());<a name="l00072"></a>00072 }<a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="comment">// ######################################################################</span><a name="l00075"></a><a class="code" href="classImage.html#9e8efb4cb518bc0ab1253ce8d5ab2783">00075</a> <span class="keywordtype">int</span> <a class="code" href="classImage.html#9e8efb4cb518bc0ab1253ce8d5ab2783" title="Returns the number of pixels in the Image.">Image::getSize</a>()<span class="keyword"> const</span><a name="l00076"></a>00076 <span class="keyword"></span>{<a name="l00077"></a>00077   <a class="code" href="mexLog_8h.html#092bd7bb2cb7fd9f483b6995cee61bc0">ASSERT</a>(<a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335" title="Returns whether the Image is initialized.">isInitialized</a>());<a name="l00078"></a>00078   <span class="keywordflow">return</span> mxGetNumberOfElements(<a class="code" href="classImage.html#35612d5fc9961d1096fcafbccabe5d0e" title="Returns a constant pointer to the underlying Matlab array.">getConstArray</a>());<a name="l00079"></a>00079 }<a name="l00080"></a>00080 <a name="l00081"></a>00081 <span class="comment">// ######################################################################</span><a name="l00082"></a><a class="code" href="classImage.html#e0666b33daa7ba55e3348d4fff02356f">00082</a> <a class="code" href="classImage.html#f9f1ae298f5d8f8b44e4e34a72f61c2f" title="Read-only iterator.">Image::const_iterator</a> <a class="code" href="classImage.html#e0666b33daa7ba55e3348d4fff02356f" title="Returns a read-only iterator to the beginning of the Image data.">Image::begin</a>()<span class="keyword"> const</span><a name="l00083"></a>00083 <span class="keyword"></span>{<a name="l00084"></a>00084   <span class="keywordflow">return</span> mxGetPr(<a class="code" href="classImage.html#35612d5fc9961d1096fcafbccabe5d0e" title="Returns a constant pointer to the underlying Matlab array.">getConstArray</a>());<a name="l00085"></a>00085 }<a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="comment">// ######################################################################</span><a name="l00088"></a><a class="code" href="classImage.html#d840a50d6451225149a4aed363b0cb91">00088</a> <a class="code" href="classImage.html#f9f1ae298f5d8f8b44e4e34a72f61c2f" title="Read-only iterator.">Image::const_iterator</a> <a class="code" href="classImage.html#d840a50d6451225149a4aed363b0cb91" title="Returns a read-only iterator to the one-past-the-end of the Image data.">Image::end</a>()<span class="keyword"> const</span><a name="l00089"></a>00089 <span class="keyword"></span>{<a name="l00090"></a>00090   <span class="keywordflow">return</span> (<a class="code" href="classImage.html#e0666b33daa7ba55e3348d4fff02356f" title="Returns a read-only iterator to the beginning of the Image data.">begin</a>() + <a class="code" href="classImage.html#9e8efb4cb518bc0ab1253ce8d5ab2783" title="Returns the number of pixels in the Image.">getSize</a>());<a name="l00091"></a>00091 }<a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">// ######################################################################</span><a name="l00094"></a><a class="code" href="classImage.html#9987bf538358f25470af7d628e97694a">00094</a> <a class="code" href="classImage.html#01d14564f4b61f97d305e293716933cf" title="Read/write iterator.">Image::iterator</a> <a class="code" href="classImage.html#9987bf538358f25470af7d628e97694a" title="Returns a read/write iterator to the beginning of the Image data.">Image::beginw</a>()<a name="l00095"></a>00095 {<a name="l00096"></a>00096   <span class="keywordflow">return</span> mxGetPr(<a class="code" href="classImage.html#eef0da5d895782bbb9ce3a17b538cf1b" title="Returns a pointer to the underlying Matlab array.">getArray</a>());<a name="l00097"></a>00097 }<a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="comment">// ######################################################################</span><a name="l00100"></a><a class="code" href="classImage.html#6bd3897cec644d5fa71e3c10a0f8b393">00100</a> <a class="code" href="classImage.html#01d14564f4b61f97d305e293716933cf" title="Read/write iterator.">Image::iterator</a> <a class="code" href="classImage.html#6bd3897cec644d5fa71e3c10a0f8b393" title="Returns a read/write iterator to the one-past-the-end of the Image data.">Image::endw</a>()<a name="l00101"></a>00101 {<a name="l00102"></a>00102   <span class="keywordflow">return</span> (<a class="code" href="classImage.html#9987bf538358f25470af7d628e97694a" title="Returns a read/write iterator to the beginning of the Image data.">beginw</a>() + <a class="code" href="classImage.html#9e8efb4cb518bc0ab1253ce8d5ab2783" title="Returns the number of pixels in the Image.">getSize</a>());<a name="l00103"></a>00103 }<a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="comment">// ######################################################################</span><a name="l00106"></a><a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335">00106</a> <span class="keywordtype">bool</span> <a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335" title="Returns whether the Image is initialized.">Image::isInitialized</a>()<span class="keyword"> const</span><a name="l00107"></a>00107 <span class="keyword"></span>{<a name="l00108"></a>00108   <span class="keywordflow">return</span> <a class="code" href="classImage.html#29d83cb67120560cbc1cd81477486b96">itsInitialized</a>;<a name="l00109"></a>00109 }<a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="comment">// ######################################################################</span><a name="l00112"></a><a class="code" href="classImage.html#eef0da5d895782bbb9ce3a17b538cf1b">00112</a> mxArray* <a class="code" href="classImage.html#eef0da5d895782bbb9ce3a17b538cf1b" title="Returns a pointer to the underlying Matlab array.">Image::getArray</a>()<a name="l00113"></a>00113 {<a name="l00114"></a>00114   <span class="keywordflow">return</span> <a class="code" href="classImage.html#f42c9d03363de26f252ff8aaba4a0680">itsArray</a>;<a name="l00115"></a>00115 }<a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="comment">// ######################################################################</span><a name="l00118"></a><a class="code" href="classImage.html#35612d5fc9961d1096fcafbccabe5d0e">00118</a> <span class="keyword">const</span> mxArray* <a class="code" href="classImage.html#35612d5fc9961d1096fcafbccabe5d0e" title="Returns a constant pointer to the underlying Matlab array.">Image::getConstArray</a>()<span class="keyword"> const</span><a name="l00119"></a>00119 <span class="keyword"></span>{<a name="l00120"></a>00120   <span class="keywordflow">return</span> <a class="code" href="classImage.html#f42c9d03363de26f252ff8aaba4a0680">itsArray</a>;<a name="l00121"></a>00121 }<a name="l00122"></a>00122 <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="comment">// ######################################################################</span><a name="l00125"></a><a class="code" href="classImage.html#e6b29adaa2f021be2f6945b146fac6fc">00125</a> <span class="keywordtype">void</span> <a class="code" href="classImage.html#e6b29adaa2f021be2f6945b146fac6fc" title="Clamp the image between bottom and top.">Image::clamp</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> bottom, <span class="keyword">const</span> <span class="keywordtype">double</span> top)<a name="l00126"></a>00126 {<a name="l00127"></a>00127   <a class="code" href="mexLog_8h.html#092bd7bb2cb7fd9f483b6995cee61bc0">ASSERT</a>(<a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335" title="Returns whether the Image is initialized.">isInitialized</a>());<a name="l00128"></a>00128   <span class="keywordflow">for</span> (<a class="code" href="classImage.html#01d14564f4b61f97d305e293716933cf" title="Read/write iterator.">iterator</a> ptr = <a class="code" href="classImage.html#9987bf538358f25470af7d628e97694a" title="Returns a read/write iterator to the beginning of the Image data.">beginw</a>(); ptr != <a class="code" href="classImage.html#6bd3897cec644d5fa71e3c10a0f8b393" title="Returns a read/write iterator to the one-past-the-end of the Image data.">endw</a>(); ++ptr)<a name="l00129"></a>00129   {<a name="l00130"></a>00130     <span class="keywordflow">if</span> (*ptr &lt; bottom) *ptr = bottom;<a name="l00131"></a>00131     <span class="keywordflow">if</span> (*ptr &gt; top) *ptr = top;<a name="l00132"></a>00132   }<a name="l00133"></a>00133 }<a name="l00134"></a>00134     <a name="l00135"></a>00135 <span class="comment">// ######################################################################</span><a name="l00136"></a><a class="code" href="classImage.html#746983fe94bf13fe2bf84ba84f5c4dd9">00136</a> <span class="keywordtype">void</span> <a class="code" href="classImage.html#746983fe94bf13fe2bf84ba84f5c4dd9" title="Clamp the image only at the bottom.">Image::clampBottom</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> bottom)<a name="l00137"></a>00137 {<a name="l00138"></a>00138   <a class="code" href="mexLog_8h.html#092bd7bb2cb7fd9f483b6995cee61bc0">ASSERT</a>(<a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335" title="Returns whether the Image is initialized.">isInitialized</a>());<a name="l00139"></a>00139   <span class="keywordflow">for</span> (<a class="code" href="classImage.html#01d14564f4b61f97d305e293716933cf" title="Read/write iterator.">iterator</a> ptr = <a class="code" href="classImage.html#9987bf538358f25470af7d628e97694a" title="Returns a read/write iterator to the beginning of the Image data.">beginw</a>(); ptr != <a class="code" href="classImage.html#6bd3897cec644d5fa71e3c10a0f8b393" title="Returns a read/write iterator to the one-past-the-end of the Image data.">endw</a>(); ++ptr)<a name="l00140"></a>00140     <span class="keywordflow">if</span> (*ptr &lt; bottom) *ptr = bottom;<a name="l00141"></a>00141 }<a name="l00142"></a>00142     <a name="l00143"></a>00143 <span class="comment">// ######################################################################</span><a name="l00144"></a><a class="code" href="classImage.html#8974e2bbdc9e778403feee80564a07a7">00144</a> <span class="keywordtype">void</span> <a class="code" href="classImage.html#8974e2bbdc9e778403feee80564a07a7" title="Clamp the image only at the top.">Image::clampTop</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> top)<a name="l00145"></a>00145 {<a name="l00146"></a>00146   <a class="code" href="mexLog_8h.html#092bd7bb2cb7fd9f483b6995cee61bc0">ASSERT</a>(<a class="code" href="classImage.html#b87bf4b103cb5a9cf090f8729f362335" title="Returns whether the Image is initialized.">isInitialized</a>());<a name="l00147"></a>00147   <span class="keywordflow">for</span> (<a class="code" href="classImage.html#01d14564f4b61f97d305e293716933cf" title="Read/write iterator.">iterator</a> ptr = <a class="code" href="classImage.html#9987bf538358f25470af7d628e97694a" title="Returns a read/write iterator to the beginning of the Image data.">beginw</a>(); ptr != <a class="code" href="classImage.html#6bd3897cec644d5fa71e3c10a0f8b393" title="Returns a read/write iterator to the one-past-the-end of the Image data.">endw</a>(); ++ptr)<a name="l00148"></a>00148     <span class="keywordflow">if</span> (*ptr &gt; top) *ptr = top;<a name="l00149"></a>00149 }<a name="l00150"></a>00150     

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?