Utils.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc (1.8.0_65) on Fri Dec 18 18:19:50 MSK 2015 -->
  6. <title>Utils</title>
  7. <meta name="date" content="2015-12-18">
  8. <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
  9. <script type="text/javascript" src="../../../script.js"></script>
  10. </head>
  11. <body>
  12. <script type="text/javascript"><!--
  13. try {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="Utils";
  16. }
  17. }
  18. catch(err) {
  19. }
  20. //-->
  21. var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9};
  22. var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
  23. var altColor = "altColor";
  24. var rowColor = "rowColor";
  25. var tableTab = "tableTab";
  26. var activeTableTab = "activeTableTab";
  27. </script>
  28. <noscript>
  29. <div>JavaScript is disabled on your browser.</div>
  30. </noscript>
  31. <!-- ========= START OF TOP NAVBAR ======= -->
  32. <div class="topNav"><a name="navbar.top">
  33. <!-- -->
  34. </a>
  35. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  36. <a name="navbar.top.firstrow">
  37. <!-- -->
  38. </a>
  39. <ul class="navList" title="Navigation">
  40. <li><a href="../../../overview-summary.html">Overview</a></li>
  41. <li><a href="package-summary.html">Package</a></li>
  42. <li class="navBarCell1Rev">Class</li>
  43. <li><a href="package-tree.html">Tree</a></li>
  44. <li><a href="../../../index-all.html">Index</a></li>
  45. <li><a href="../../../help-doc.html">Help</a></li>
  46. </ul>
  47. <div class="aboutLanguage">OpenCV 3.1.0</div>
  48. </div>
  49. <div class="subNav">
  50. <ul class="navList">
  51. <li><a href="../../../org/opencv/android/OpenCVLoader.html" title="class in org.opencv.android"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  52. <li>Next&nbsp;Class</li>
  53. </ul>
  54. <ul class="navList">
  55. <li><a href="../../../index.html?org/opencv/android/Utils.html" target="_top">Frames</a></li>
  56. <li><a href="Utils.html" target="_top">No&nbsp;Frames</a></li>
  57. </ul>
  58. <ul class="navList" id="allclasses_navbar_top">
  59. <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  60. </ul>
  61. <div>
  62. <script type="text/javascript"><!--
  63. allClassesLink = document.getElementById("allclasses_navbar_top");
  64. if(window==top) {
  65. allClassesLink.style.display = "block";
  66. }
  67. else {
  68. allClassesLink.style.display = "none";
  69. }
  70. //-->
  71. </script>
  72. </div>
  73. <div>
  74. <ul class="subNavList">
  75. <li>Summary:&nbsp;</li>
  76. <li>Nested&nbsp;|&nbsp;</li>
  77. <li>Field&nbsp;|&nbsp;</li>
  78. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  79. <li><a href="#method.summary">Method</a></li>
  80. </ul>
  81. <ul class="subNavList">
  82. <li>Detail:&nbsp;</li>
  83. <li>Field&nbsp;|&nbsp;</li>
  84. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  85. <li><a href="#method.detail">Method</a></li>
  86. </ul>
  87. </div>
  88. <a name="skip.navbar.top">
  89. <!-- -->
  90. </a></div>
  91. <!-- ========= END OF TOP NAVBAR ========= -->
  92. <!-- ======== START OF CLASS DATA ======== -->
  93. <div class="header">
  94. <div class="subTitle">org.opencv.android</div>
  95. <h2 title="Class Utils" class="title">Class Utils</h2>
  96. </div>
  97. <div class="contentContainer">
  98. <ul class="inheritance">
  99. <li>java.lang.Object</li>
  100. <li>
  101. <ul class="inheritance">
  102. <li>org.opencv.android.Utils</li>
  103. </ul>
  104. </li>
  105. </ul>
  106. <div class="description">
  107. <ul class="blockList">
  108. <li class="blockList">
  109. <hr>
  110. <br>
  111. <pre>public class <span class="typeNameLabel">Utils</span>
  112. extends java.lang.Object</pre>
  113. </li>
  114. </ul>
  115. </div>
  116. <div class="summary">
  117. <ul class="blockList">
  118. <li class="blockList">
  119. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  120. <ul class="blockList">
  121. <li class="blockList"><a name="constructor.summary">
  122. <!-- -->
  123. </a>
  124. <h3>Constructor Summary</h3>
  125. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
  126. <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
  127. <tr>
  128. <th class="colOne" scope="col">Constructor and Description</th>
  129. </tr>
  130. <tr class="altColor">
  131. <td class="colOne"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#Utils--">Utils</a></span>()</code>&nbsp;</td>
  132. </tr>
  133. </table>
  134. </li>
  135. </ul>
  136. <!-- ========== METHOD SUMMARY =========== -->
  137. <ul class="blockList">
  138. <li class="blockList"><a name="method.summary">
  139. <!-- -->
  140. </a>
  141. <h3>Method Summary</h3>
  142. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  143. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  144. <tr>
  145. <th class="colFirst" scope="col">Modifier and Type</th>
  146. <th class="colLast" scope="col">Method and Description</th>
  147. </tr>
  148. <tr id="i0" class="altColor">
  149. <td class="colFirst"><code>static void</code></td>
  150. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#bitmapToMat-android.graphics.Bitmap-org.opencv.core.Mat-">bitmapToMat</a></span>(android.graphics.Bitmap&nbsp;bmp,
  151. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat)</code>
  152. <div class="block">Short form of the bitmapToMat(bmp, mat, unPremultiplyAlpha=false).</div>
  153. </td>
  154. </tr>
  155. <tr id="i1" class="rowColor">
  156. <td class="colFirst"><code>static void</code></td>
  157. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#bitmapToMat-android.graphics.Bitmap-org.opencv.core.Mat-boolean-">bitmapToMat</a></span>(android.graphics.Bitmap&nbsp;bmp,
  158. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat,
  159. boolean&nbsp;unPremultiplyAlpha)</code>
  160. <div class="block">Converts Android Bitmap to OpenCV Mat.</div>
  161. </td>
  162. </tr>
  163. <tr id="i2" class="altColor">
  164. <td class="colFirst"><code>static java.lang.String</code></td>
  165. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#exportResource-android.content.Context-int-">exportResource</a></span>(android.content.Context&nbsp;context,
  166. int&nbsp;resourceId)</code>&nbsp;</td>
  167. </tr>
  168. <tr id="i3" class="rowColor">
  169. <td class="colFirst"><code>static java.lang.String</code></td>
  170. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#exportResource-android.content.Context-int-java.lang.String-">exportResource</a></span>(android.content.Context&nbsp;context,
  171. int&nbsp;resourceId,
  172. java.lang.String&nbsp;dirname)</code>&nbsp;</td>
  173. </tr>
  174. <tr id="i4" class="altColor">
  175. <td class="colFirst"><code>static <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a></code></td>
  176. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#loadResource-android.content.Context-int-">loadResource</a></span>(android.content.Context&nbsp;context,
  177. int&nbsp;resourceId)</code>&nbsp;</td>
  178. </tr>
  179. <tr id="i5" class="rowColor">
  180. <td class="colFirst"><code>static <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a></code></td>
  181. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#loadResource-android.content.Context-int-int-">loadResource</a></span>(android.content.Context&nbsp;context,
  182. int&nbsp;resourceId,
  183. int&nbsp;flags)</code>&nbsp;</td>
  184. </tr>
  185. <tr id="i6" class="altColor">
  186. <td class="colFirst"><code>static void</code></td>
  187. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#matToBitmap-org.opencv.core.Mat-android.graphics.Bitmap-">matToBitmap</a></span>(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat,
  188. android.graphics.Bitmap&nbsp;bmp)</code>
  189. <div class="block">Short form of the <b>matToBitmap(mat, bmp, premultiplyAlpha=false)</b></div>
  190. </td>
  191. </tr>
  192. <tr id="i7" class="rowColor">
  193. <td class="colFirst"><code>static void</code></td>
  194. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/android/Utils.html#matToBitmap-org.opencv.core.Mat-android.graphics.Bitmap-boolean-">matToBitmap</a></span>(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat,
  195. android.graphics.Bitmap&nbsp;bmp,
  196. boolean&nbsp;premultiplyAlpha)</code>
  197. <div class="block">Converts OpenCV Mat to Android Bitmap.</div>
  198. </td>
  199. </tr>
  200. </table>
  201. <ul class="blockList">
  202. <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
  203. <!-- -->
  204. </a>
  205. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  206. <code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
  207. </ul>
  208. </li>
  209. </ul>
  210. </li>
  211. </ul>
  212. </div>
  213. <div class="details">
  214. <ul class="blockList">
  215. <li class="blockList">
  216. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  217. <ul class="blockList">
  218. <li class="blockList"><a name="constructor.detail">
  219. <!-- -->
  220. </a>
  221. <h3>Constructor Detail</h3>
  222. <a name="Utils--">
  223. <!-- -->
  224. </a>
  225. <ul class="blockListLast">
  226. <li class="blockList">
  227. <h4>Utils</h4>
  228. <pre>public&nbsp;Utils()</pre>
  229. </li>
  230. </ul>
  231. </li>
  232. </ul>
  233. <!-- ============ METHOD DETAIL ========== -->
  234. <ul class="blockList">
  235. <li class="blockList"><a name="method.detail">
  236. <!-- -->
  237. </a>
  238. <h3>Method Detail</h3>
  239. <a name="bitmapToMat-android.graphics.Bitmap-org.opencv.core.Mat-">
  240. <!-- -->
  241. </a>
  242. <ul class="blockList">
  243. <li class="blockList">
  244. <h4>bitmapToMat</h4>
  245. <pre>public static&nbsp;void&nbsp;bitmapToMat(android.graphics.Bitmap&nbsp;bmp,
  246. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat)</pre>
  247. <div class="block">Short form of the bitmapToMat(bmp, mat, unPremultiplyAlpha=false).</div>
  248. <dl>
  249. <dt><span class="paramLabel">Parameters:</span></dt>
  250. <dd><code>bmp</code> - is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.</dd>
  251. <dd><code>mat</code> - is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.</dd>
  252. </dl>
  253. </li>
  254. </ul>
  255. <a name="bitmapToMat-android.graphics.Bitmap-org.opencv.core.Mat-boolean-">
  256. <!-- -->
  257. </a>
  258. <ul class="blockList">
  259. <li class="blockList">
  260. <h4>bitmapToMat</h4>
  261. <pre>public static&nbsp;void&nbsp;bitmapToMat(android.graphics.Bitmap&nbsp;bmp,
  262. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat,
  263. boolean&nbsp;unPremultiplyAlpha)</pre>
  264. <div class="block">Converts Android Bitmap to OpenCV Mat.
  265. <p>
  266. This function converts an Android Bitmap image to the OpenCV Mat.
  267. <br>'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
  268. <br>The output Mat is always created of the same size as the input Bitmap and of the 'CV_8UC4' type,
  269. it keeps the image in RGBA format.
  270. <br>This function throws an exception if the conversion fails.</div>
  271. <dl>
  272. <dt><span class="paramLabel">Parameters:</span></dt>
  273. <dd><code>bmp</code> - is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.</dd>
  274. <dd><code>mat</code> - is a valid output Mat object, it will be reallocated if needed, so it may be empty.</dd>
  275. <dd><code>unPremultiplyAlpha</code> - is a flag, that determines, whether the bitmap needs to be converted from alpha premultiplied format (like Android keeps 'ARGB_8888' ones) to regular one; this flag is ignored for 'RGB_565' bitmaps.</dd>
  276. </dl>
  277. </li>
  278. </ul>
  279. <a name="exportResource-android.content.Context-int-">
  280. <!-- -->
  281. </a>
  282. <ul class="blockList">
  283. <li class="blockList">
  284. <h4>exportResource</h4>
  285. <pre>public static&nbsp;java.lang.String&nbsp;exportResource(android.content.Context&nbsp;context,
  286. int&nbsp;resourceId)</pre>
  287. </li>
  288. </ul>
  289. <a name="exportResource-android.content.Context-int-java.lang.String-">
  290. <!-- -->
  291. </a>
  292. <ul class="blockList">
  293. <li class="blockList">
  294. <h4>exportResource</h4>
  295. <pre>public static&nbsp;java.lang.String&nbsp;exportResource(android.content.Context&nbsp;context,
  296. int&nbsp;resourceId,
  297. java.lang.String&nbsp;dirname)</pre>
  298. </li>
  299. </ul>
  300. <a name="loadResource-android.content.Context-int-">
  301. <!-- -->
  302. </a>
  303. <ul class="blockList">
  304. <li class="blockList">
  305. <h4>loadResource</h4>
  306. <pre>public static&nbsp;<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;loadResource(android.content.Context&nbsp;context,
  307. int&nbsp;resourceId)
  308. throws java.io.IOException</pre>
  309. <dl>
  310. <dt><span class="throwsLabel">Throws:</span></dt>
  311. <dd><code>java.io.IOException</code></dd>
  312. </dl>
  313. </li>
  314. </ul>
  315. <a name="loadResource-android.content.Context-int-int-">
  316. <!-- -->
  317. </a>
  318. <ul class="blockList">
  319. <li class="blockList">
  320. <h4>loadResource</h4>
  321. <pre>public static&nbsp;<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;loadResource(android.content.Context&nbsp;context,
  322. int&nbsp;resourceId,
  323. int&nbsp;flags)
  324. throws java.io.IOException</pre>
  325. <dl>
  326. <dt><span class="throwsLabel">Throws:</span></dt>
  327. <dd><code>java.io.IOException</code></dd>
  328. </dl>
  329. </li>
  330. </ul>
  331. <a name="matToBitmap-org.opencv.core.Mat-android.graphics.Bitmap-">
  332. <!-- -->
  333. </a>
  334. <ul class="blockList">
  335. <li class="blockList">
  336. <h4>matToBitmap</h4>
  337. <pre>public static&nbsp;void&nbsp;matToBitmap(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat,
  338. android.graphics.Bitmap&nbsp;bmp)</pre>
  339. <div class="block">Short form of the <b>matToBitmap(mat, bmp, premultiplyAlpha=false)</b></div>
  340. <dl>
  341. <dt><span class="paramLabel">Parameters:</span></dt>
  342. <dd><code>mat</code> - is a valid input Mat object of the types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.</dd>
  343. <dd><code>bmp</code> - is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.</dd>
  344. </dl>
  345. </li>
  346. </ul>
  347. <a name="matToBitmap-org.opencv.core.Mat-android.graphics.Bitmap-boolean-">
  348. <!-- -->
  349. </a>
  350. <ul class="blockListLast">
  351. <li class="blockList">
  352. <h4>matToBitmap</h4>
  353. <pre>public static&nbsp;void&nbsp;matToBitmap(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;mat,
  354. android.graphics.Bitmap&nbsp;bmp,
  355. boolean&nbsp;premultiplyAlpha)</pre>
  356. <div class="block">Converts OpenCV Mat to Android Bitmap.
  357. <p>
  358. <br>This function converts an image in the OpenCV Mat representation to the Android Bitmap.
  359. <br>The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
  360. <br>The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
  361. <br>This function throws an exception if the conversion fails.</div>
  362. <dl>
  363. <dt><span class="paramLabel">Parameters:</span></dt>
  364. <dd><code>mat</code> - is a valid input Mat object of types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.</dd>
  365. <dd><code>bmp</code> - is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.</dd>
  366. <dd><code>premultiplyAlpha</code> - is a flag, that determines, whether the Mat needs to be converted to alpha premultiplied format (like Android keeps 'ARGB_8888' bitmaps); the flag is ignored for 'RGB_565' bitmaps.</dd>
  367. </dl>
  368. </li>
  369. </ul>
  370. </li>
  371. </ul>
  372. </li>
  373. </ul>
  374. </div>
  375. </div>
  376. <!-- ========= END OF CLASS DATA ========= -->
  377. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  378. <div class="bottomNav"><a name="navbar.bottom">
  379. <!-- -->
  380. </a>
  381. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  382. <a name="navbar.bottom.firstrow">
  383. <!-- -->
  384. </a>
  385. <ul class="navList" title="Navigation">
  386. <li><a href="../../../overview-summary.html">Overview</a></li>
  387. <li><a href="package-summary.html">Package</a></li>
  388. <li class="navBarCell1Rev">Class</li>
  389. <li><a href="package-tree.html">Tree</a></li>
  390. <li><a href="../../../index-all.html">Index</a></li>
  391. <li><a href="../../../help-doc.html">Help</a></li>
  392. </ul>
  393. <div class="aboutLanguage"><a href="http://docs.opencv.org">OpenCV 3.1.0 Documentation</a></div>
  394. </div>
  395. <div class="subNav">
  396. <ul class="navList">
  397. <li><a href="../../../org/opencv/android/OpenCVLoader.html" title="class in org.opencv.android"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  398. <li>Next&nbsp;Class</li>
  399. </ul>
  400. <ul class="navList">
  401. <li><a href="../../../index.html?org/opencv/android/Utils.html" target="_top">Frames</a></li>
  402. <li><a href="Utils.html" target="_top">No&nbsp;Frames</a></li>
  403. </ul>
  404. <ul class="navList" id="allclasses_navbar_bottom">
  405. <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  406. </ul>
  407. <div>
  408. <script type="text/javascript"><!--
  409. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  410. if(window==top) {
  411. allClassesLink.style.display = "block";
  412. }
  413. else {
  414. allClassesLink.style.display = "none";
  415. }
  416. //-->
  417. </script>
  418. </div>
  419. <div>
  420. <ul class="subNavList">
  421. <li>Summary:&nbsp;</li>
  422. <li>Nested&nbsp;|&nbsp;</li>
  423. <li>Field&nbsp;|&nbsp;</li>
  424. <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
  425. <li><a href="#method.summary">Method</a></li>
  426. </ul>
  427. <ul class="subNavList">
  428. <li>Detail:&nbsp;</li>
  429. <li>Field&nbsp;|&nbsp;</li>
  430. <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
  431. <li><a href="#method.detail">Method</a></li>
  432. </ul>
  433. </div>
  434. <a name="skip.navbar.bottom">
  435. <!-- -->
  436. </a></div>
  437. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  438. </body>
  439. </html>