chillerlan-QRCode-Decoder-Binarizer.html 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Documentation</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <base href="../">
  8. <link rel="icon" href="images/favicon.ico"/>
  9. <link rel="stylesheet" href="css/normalize.css">
  10. <link rel="stylesheet" href="css/base.css">
  11. <link rel="preconnect" href="https://fonts.gstatic.com">
  12. <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@100;200;300;400;600;700&display=swap" rel="stylesheet">
  13. <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
  14. <link rel="stylesheet" href="css/template.css">
  15. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
  16. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
  17. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
  18. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
  19. <script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
  20. <script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
  21. <script src="js/template.js"></script>
  22. <script src="js/search.js"></script>
  23. <script defer src="js/searchIndex.js"></script>
  24. </head>
  25. <body id="top">
  26. <header class="phpdocumentor-header phpdocumentor-section">
  27. <h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
  28. <input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
  29. <label class="phpdocumentor-header__menu-icon" for="menu-button">
  30. <i class="fas fa-bars"></i>
  31. </label>
  32. <section data-search-form class="phpdocumentor-search">
  33. <label>
  34. <span class="visually-hidden">Search for</span>
  35. <svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  36. <circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
  37. <line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
  38. </svg>
  39. <input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
  40. </label>
  41. </section>
  42. <nav class="phpdocumentor-topnav">
  43. <ul class="phpdocumentor-topnav__menu">
  44. <li class="phpdocumentor-topnav__menu-item -menu">
  45. <a href="https://php-qrcode.readthedocs.io">
  46. <span>
  47. User Manual
  48. </span>
  49. </a>
  50. </li>
  51. <li class="phpdocumentor-topnav__menu-item -social">
  52. <a href="https://github.com/chillerlan/php-qrcode">
  53. <span>
  54. <i class="fab fa-github"></i>
  55. </span>
  56. </a>
  57. </li>
  58. </ul>
  59. </nav>
  60. </header>
  61. <main class="phpdocumentor">
  62. <div class="phpdocumentor-section">
  63. <input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
  64. <label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
  65. Menu
  66. </label>
  67. <aside class="phpdocumentor-column -three phpdocumentor-sidebar">
  68. <section class="phpdocumentor-sidebar__category">
  69. <h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
  70. <h4 class="phpdocumentor-sidebar__root-namespace">
  71. <a href="namespaces/chillerlan.html" class="">chillerlan</a>
  72. </h4>
  73. <ul class="phpdocumentor-list">
  74. <li>
  75. <a href="namespaces/chillerlan-qrcode.html" class="">QRCode</a>
  76. </li>
  77. <li>
  78. <a href="namespaces/chillerlan-qrcodetest.html" class="">QRCodeTest</a>
  79. </li>
  80. </ul>
  81. </section>
  82. <section class="phpdocumentor-sidebar__category">
  83. <h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
  84. <h4 class="phpdocumentor-sidebar__root-namespace">
  85. <a href="packages/Application.html" class="">Application</a>
  86. </h4>
  87. </section>
  88. <section class="phpdocumentor-sidebar__category">
  89. <h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
  90. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
  91. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
  92. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
  93. </section>
  94. <section class="phpdocumentor-sidebar__category">
  95. <h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
  96. <h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
  97. </section>
  98. </aside>
  99. <div class="phpdocumentor-column -nine phpdocumentor-content">
  100. <section>
  101. <ul class="phpdocumentor-breadcrumbs">
  102. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan.html">chillerlan</a></li>
  103. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode.html">QRCode</a></li>
  104. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode-decoder.html">Decoder</a></li>
  105. </ul>
  106. <article class="phpdocumentor-element -class">
  107. <h2 class="phpdocumentor-content__title">
  108. Binarizer
  109. <div class="phpdocumentor-element__package">
  110. in package
  111. <ul class="phpdocumentor-breadcrumbs">
  112. <li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
  113. </ul>
  114. </div>
  115. </h2>
  116. <div class="phpdocumentor-label-line">
  117. <div class="phpdocumentor-label phpdocumentor-label--success"><span>Final</span><span>Yes</span></div>
  118. </div>
  119. <aside class="phpdocumentor-element-found-in">
  120. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  121. :
  122. <span class="phpdocumentor-element-found-in__line">34</span>
  123. </aside>
  124. <p class="phpdocumentor-summary">This class implements a local thresholding algorithm, which while slower than the
  125. GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for
  126. high frequency images of barcodes with black data on white backgrounds. For this application,
  127. it does a much better job than a global blackpoint with severe shadows and gradients.</p>
  128. <section class="phpdocumentor-description"><p>However, it tends to produce artifacts on lower frequency images and is therefore not
  129. a good general purpose binarizer for uses outside ZXing.</p>
  130. <p>This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers,
  131. and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already
  132. inherently local, and only fails for horizontal gradients. We can revisit that problem later,
  133. but for now it was not a win to use local blocks for 1D.</p>
  134. <p>This Binarizer is the default for the unit tests and the recommended class for library users.</p>
  135. </section>
  136. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  137. Tags
  138. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#tags" class="headerlink"><i class="fas fa-link"></i></a>
  139. </h5>
  140. <dl class="phpdocumentor-tag-list">
  141. <dt class="phpdocumentor-tag-list__entry">
  142. <span class="phpdocumentor-tag__name">author</span>
  143. </dt>
  144. <dd class="phpdocumentor-tag-list__definition">
  145. <section class="phpdocumentor-description"><p>dswitkin@google.com (Daniel Switkin)</p>
  146. </section>
  147. </dd>
  148. </dl>
  149. <h3 id="toc">
  150. Table of Contents
  151. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc" class="headerlink"><i class="fas fa-link"></i></a>
  152. </h3>
  153. <h4 id="toc-constants">
  154. Constants
  155. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc-constants" class="headerlink"><i class="fas fa-link"></i></a>
  156. </h4>
  157. <dl class="phpdocumentor-table-of-contents">
  158. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  159. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE">BLOCK_SIZE</a>
  160. <span>
  161. &nbsp;= 8 </span>
  162. </dt>
  163. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  164. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE_MASK">BLOCK_SIZE_MASK</a>
  165. <span>
  166. &nbsp;= 7 </span>
  167. </dt>
  168. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  169. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE_POWER">BLOCK_SIZE_POWER</a>
  170. <span>
  171. &nbsp;= 3 </span>
  172. </dt>
  173. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  174. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_LUMINANCE_BUCKETS">LUMINANCE_BUCKETS</a>
  175. <span>
  176. &nbsp;= 32 </span>
  177. </dt>
  178. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  179. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_LUMINANCE_SHIFT">LUMINANCE_SHIFT</a>
  180. <span>
  181. &nbsp;= 3 </span>
  182. </dt>
  183. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  184. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_MIN_DYNAMIC_RANGE">MIN_DYNAMIC_RANGE</a>
  185. <span>
  186. &nbsp;= 24 </span>
  187. </dt>
  188. <dt class="phpdocumentor-table-of-contents__entry -constant -private">
  189. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_MINIMUM_DIMENSION">MINIMUM_DIMENSION</a>
  190. <span>
  191. &nbsp;= 40 </span>
  192. </dt>
  193. </dl>
  194. <h4 id="toc-properties">
  195. Properties
  196. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc-properties" class="headerlink"><i class="fas fa-link"></i></a>
  197. </h4>
  198. <dl class="phpdocumentor-table-of-contents">
  199. <dt class="phpdocumentor-table-of-contents__entry -property -private">
  200. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#property_luminances">$luminances</a>
  201. <span>
  202. &nbsp;: array&lt;string|int, mixed&gt; </span>
  203. </dt>
  204. <dt class="phpdocumentor-table-of-contents__entry -property -private">
  205. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#property_source">$source</a>
  206. <span>
  207. &nbsp;: <a href="classes/chillerlan-QRCode-Decoder-LuminanceSourceInterface.html"><abbr title="\chillerlan\QRCode\Decoder\LuminanceSourceInterface">LuminanceSourceInterface</abbr></a> </span>
  208. </dt>
  209. </dl>
  210. <h4 id="toc-methods">
  211. Methods
  212. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc-methods" class="headerlink"><i class="fas fa-link"></i></a>
  213. </h4>
  214. <dl class="phpdocumentor-table-of-contents">
  215. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  216. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method___construct">__construct()</a>
  217. <span>
  218. &nbsp;: mixed </span>
  219. </dt>
  220. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  221. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_getBlackMatrix">getBlackMatrix()</a>
  222. <span>
  223. &nbsp;: <a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a> </span>
  224. </dt>
  225. <dd>Calculates the final BitMatrix once for all requests. This could be called once from the
  226. constructor instead, but there are some advantages to doing it lazily, such as making
  227. profiling easier, and not doing heavy lifting when callers don&#039;t expect it.</dd>
  228. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  229. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateBlackPoints">calculateBlackPoints()</a>
  230. <span>
  231. &nbsp;: array&lt;string|int, mixed&gt; </span>
  232. </dt>
  233. <dd>Calculates a single black point for each block of pixels and saves it away.</dd>
  234. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  235. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateThresholdForBlock">calculateThresholdForBlock()</a>
  236. <span>
  237. &nbsp;: <a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a> </span>
  238. </dt>
  239. <dd>For each block in the image, calculate the average black point using a 5x5 grid
  240. of the surrounding blocks. Also handles the corner cases (fractional blocks are computed based
  241. on the last pixels in the row/column which are also used in the previous block).</dd>
  242. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  243. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_cap">cap()</a>
  244. <span>
  245. &nbsp;: int </span>
  246. </dt>
  247. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  248. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_estimateBlackPoint">estimateBlackPoint()</a>
  249. <span>
  250. &nbsp;: int </span>
  251. </dt>
  252. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  253. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_getHistogramBlackMatrix">getHistogramBlackMatrix()</a>
  254. <span>
  255. &nbsp;: <a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a> </span>
  256. </dt>
  257. </dl>
  258. <section class="phpdocumentor-constants">
  259. <h3 class="phpdocumentor-elements__header" id="constants">
  260. Constants
  261. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constants" class="headerlink"><i class="fas fa-link"></i></a>
  262. </h3>
  263. <article class="phpdocumentor-element -constant -private ">
  264. <h4 class="phpdocumentor-element__name" id="constant_BLOCK_SIZE">
  265. BLOCK_SIZE
  266. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE" class="headerlink"><i class="fas fa-link"></i></a>
  267. </h4>
  268. <aside class="phpdocumentor-element-found-in">
  269. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  270. :
  271. <span class="phpdocumentor-element-found-in__line">39</span>
  272. </aside>
  273. <code class="phpdocumentor-signature phpdocumentor-code ">
  274. <span class="phpdocumentor-signature__visibility">private</span>
  275. <span class="phpdocumentor-signature__type">mixed</span>
  276. <span class="phpdocumentor-signature__name">BLOCK_SIZE</span>
  277. = <span class="phpdocumentor-signature__default-value">8</span>
  278. </code>
  279. </article>
  280. <article class="phpdocumentor-element -constant -private ">
  281. <h4 class="phpdocumentor-element__name" id="constant_BLOCK_SIZE_MASK">
  282. BLOCK_SIZE_MASK
  283. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE_MASK" class="headerlink"><i class="fas fa-link"></i></a>
  284. </h4>
  285. <aside class="phpdocumentor-element-found-in">
  286. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  287. :
  288. <span class="phpdocumentor-element-found-in__line">40</span>
  289. </aside>
  290. <code class="phpdocumentor-signature phpdocumentor-code ">
  291. <span class="phpdocumentor-signature__visibility">private</span>
  292. <span class="phpdocumentor-signature__type">mixed</span>
  293. <span class="phpdocumentor-signature__name">BLOCK_SIZE_MASK</span>
  294. = <span class="phpdocumentor-signature__default-value">7</span>
  295. </code>
  296. </article>
  297. <article class="phpdocumentor-element -constant -private ">
  298. <h4 class="phpdocumentor-element__name" id="constant_BLOCK_SIZE_POWER">
  299. BLOCK_SIZE_POWER
  300. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE_POWER" class="headerlink"><i class="fas fa-link"></i></a>
  301. </h4>
  302. <aside class="phpdocumentor-element-found-in">
  303. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  304. :
  305. <span class="phpdocumentor-element-found-in__line">38</span>
  306. </aside>
  307. <code class="phpdocumentor-signature phpdocumentor-code ">
  308. <span class="phpdocumentor-signature__visibility">private</span>
  309. <span class="phpdocumentor-signature__type">mixed</span>
  310. <span class="phpdocumentor-signature__name">BLOCK_SIZE_POWER</span>
  311. = <span class="phpdocumentor-signature__default-value">3</span>
  312. </code>
  313. </article>
  314. <article class="phpdocumentor-element -constant -private ">
  315. <h4 class="phpdocumentor-element__name" id="constant_LUMINANCE_BUCKETS">
  316. LUMINANCE_BUCKETS
  317. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_LUMINANCE_BUCKETS" class="headerlink"><i class="fas fa-link"></i></a>
  318. </h4>
  319. <aside class="phpdocumentor-element-found-in">
  320. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  321. :
  322. <span class="phpdocumentor-element-found-in__line">46</span>
  323. </aside>
  324. <code class="phpdocumentor-signature phpdocumentor-code ">
  325. <span class="phpdocumentor-signature__visibility">private</span>
  326. <span class="phpdocumentor-signature__type">mixed</span>
  327. <span class="phpdocumentor-signature__name">LUMINANCE_BUCKETS</span>
  328. = <span class="phpdocumentor-signature__default-value">32</span>
  329. </code>
  330. </article>
  331. <article class="phpdocumentor-element -constant -private ">
  332. <h4 class="phpdocumentor-element__name" id="constant_LUMINANCE_SHIFT">
  333. LUMINANCE_SHIFT
  334. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_LUMINANCE_SHIFT" class="headerlink"><i class="fas fa-link"></i></a>
  335. </h4>
  336. <aside class="phpdocumentor-element-found-in">
  337. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  338. :
  339. <span class="phpdocumentor-element-found-in__line">45</span>
  340. </aside>
  341. <code class="phpdocumentor-signature phpdocumentor-code ">
  342. <span class="phpdocumentor-signature__visibility">private</span>
  343. <span class="phpdocumentor-signature__type">mixed</span>
  344. <span class="phpdocumentor-signature__name">LUMINANCE_SHIFT</span>
  345. = <span class="phpdocumentor-signature__default-value">3</span>
  346. </code>
  347. </article>
  348. <article class="phpdocumentor-element -constant -private ">
  349. <h4 class="phpdocumentor-element__name" id="constant_MIN_DYNAMIC_RANGE">
  350. MIN_DYNAMIC_RANGE
  351. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_MIN_DYNAMIC_RANGE" class="headerlink"><i class="fas fa-link"></i></a>
  352. </h4>
  353. <aside class="phpdocumentor-element-found-in">
  354. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  355. :
  356. <span class="phpdocumentor-element-found-in__line">42</span>
  357. </aside>
  358. <code class="phpdocumentor-signature phpdocumentor-code ">
  359. <span class="phpdocumentor-signature__visibility">private</span>
  360. <span class="phpdocumentor-signature__type">mixed</span>
  361. <span class="phpdocumentor-signature__name">MIN_DYNAMIC_RANGE</span>
  362. = <span class="phpdocumentor-signature__default-value">24</span>
  363. </code>
  364. </article>
  365. <article class="phpdocumentor-element -constant -private ">
  366. <h4 class="phpdocumentor-element__name" id="constant_MINIMUM_DIMENSION">
  367. MINIMUM_DIMENSION
  368. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_MINIMUM_DIMENSION" class="headerlink"><i class="fas fa-link"></i></a>
  369. </h4>
  370. <aside class="phpdocumentor-element-found-in">
  371. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  372. :
  373. <span class="phpdocumentor-element-found-in__line">41</span>
  374. </aside>
  375. <code class="phpdocumentor-signature phpdocumentor-code ">
  376. <span class="phpdocumentor-signature__visibility">private</span>
  377. <span class="phpdocumentor-signature__type">mixed</span>
  378. <span class="phpdocumentor-signature__name">MINIMUM_DIMENSION</span>
  379. = <span class="phpdocumentor-signature__default-value">40</span>
  380. </code>
  381. </article>
  382. </section>
  383. <section class="phpdocumentor-properties">
  384. <h3 class="phpdocumentor-elements__header" id="properties">
  385. Properties
  386. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
  387. </h3>
  388. <article
  389. class="
  390. phpdocumentor-element
  391. -property
  392. -private
  393. "
  394. >
  395. <h4 class="phpdocumentor-element__name" id="property_luminances">
  396. $luminances
  397. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#property_luminances" class="headerlink"><i class="fas fa-link"></i></a>
  398. <span class="phpdocumentor-element__modifiers">
  399. </span>
  400. </h4>
  401. <aside class="phpdocumentor-element-found-in">
  402. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  403. :
  404. <span class="phpdocumentor-element-found-in__line">49</span>
  405. </aside>
  406. <code class="phpdocumentor-code phpdocumentor-signature ">
  407. <span class="phpdocumentor-signature__visibility">private</span>
  408. <span class="phpdocumentor-signature__type">array&lt;string|int, mixed&gt;</span>
  409. <span class="phpdocumentor-signature__name">$luminances</span>
  410. </code>
  411. </article>
  412. <article
  413. class="
  414. phpdocumentor-element
  415. -property
  416. -private
  417. "
  418. >
  419. <h4 class="phpdocumentor-element__name" id="property_source">
  420. $source
  421. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#property_source" class="headerlink"><i class="fas fa-link"></i></a>
  422. <span class="phpdocumentor-element__modifiers">
  423. </span>
  424. </h4>
  425. <aside class="phpdocumentor-element-found-in">
  426. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  427. :
  428. <span class="phpdocumentor-element-found-in__line">48</span>
  429. </aside>
  430. <code class="phpdocumentor-code phpdocumentor-signature ">
  431. <span class="phpdocumentor-signature__visibility">private</span>
  432. <span class="phpdocumentor-signature__type"><a href="classes/chillerlan-QRCode-Decoder-LuminanceSourceInterface.html"><abbr title="\chillerlan\QRCode\Decoder\LuminanceSourceInterface">LuminanceSourceInterface</abbr></a></span>
  433. <span class="phpdocumentor-signature__name">$source</span>
  434. </code>
  435. </article>
  436. </section>
  437. <section class="phpdocumentor-methods">
  438. <h3 class="phpdocumentor-elements__header" id="methods">
  439. Methods
  440. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
  441. </h3>
  442. <article
  443. class="phpdocumentor-element
  444. -method
  445. -public
  446. "
  447. >
  448. <h4 class="phpdocumentor-element__name" id="method___construct">
  449. __construct()
  450. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
  451. </h4>
  452. <aside class="phpdocumentor-element-found-in">
  453. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  454. :
  455. <span class="phpdocumentor-element-found-in__line">54</span>
  456. </aside>
  457. <code class="phpdocumentor-code phpdocumentor-signature ">
  458. <span class="phpdocumentor-signature__visibility">public</span>
  459. <span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><a href="classes/chillerlan-QRCode-Decoder-LuminanceSourceInterface.html"><abbr title="\chillerlan\QRCode\Decoder\LuminanceSourceInterface">LuminanceSourceInterface</abbr></a>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$source</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
  460. <div class="phpdocumentor-label-line">
  461. </div>
  462. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  463. <dl class="phpdocumentor-argument-list">
  464. <dt class="phpdocumentor-argument-list__entry">
  465. <span class="phpdocumentor-signature__argument__name">$source</span>
  466. : <span class="phpdocumentor-signature__argument__return-type"><a href="classes/chillerlan-QRCode-Decoder-LuminanceSourceInterface.html"><abbr title="\chillerlan\QRCode\Decoder\LuminanceSourceInterface">LuminanceSourceInterface</abbr></a></span>
  467. </dt>
  468. <dd class="phpdocumentor-argument-list__definition">
  469. </dd>
  470. </dl>
  471. </article>
  472. <article
  473. class="phpdocumentor-element
  474. -method
  475. -public
  476. "
  477. >
  478. <h4 class="phpdocumentor-element__name" id="method_getBlackMatrix">
  479. getBlackMatrix()
  480. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_getBlackMatrix" class="headerlink"><i class="fas fa-link"></i></a>
  481. </h4>
  482. <aside class="phpdocumentor-element-found-in">
  483. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  484. :
  485. <span class="phpdocumentor-element-found-in__line">138</span>
  486. </aside>
  487. <p class="phpdocumentor-summary">Calculates the final BitMatrix once for all requests. This could be called once from the
  488. constructor instead, but there are some advantages to doing it lazily, such as making
  489. profiling easier, and not doing heavy lifting when callers don&#039;t expect it.</p>
  490. <code class="phpdocumentor-code phpdocumentor-signature ">
  491. <span class="phpdocumentor-signature__visibility">public</span>
  492. <span class="phpdocumentor-signature__name">getBlackMatrix</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span></code>
  493. <div class="phpdocumentor-label-line">
  494. </div>
  495. <section class="phpdocumentor-description"><p>Converts a 2D array of luminance data to 1 bit data. As above, assume this method is expensive
  496. and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or
  497. may not apply sharpening. Therefore, a row from this matrix may not be identical to one
  498. fetched using getBlackRow(), so don't mix and match between them.</p>
  499. </section>
  500. <section>
  501. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  502. <span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span>
  503. &mdash;
  504. <section class="phpdocumentor-description"><p>The 2D array of bits for the image (true means black).</p>
  505. </section>
  506. </section>
  507. </article>
  508. <article
  509. class="phpdocumentor-element
  510. -method
  511. -private
  512. "
  513. >
  514. <h4 class="phpdocumentor-element__name" id="method_calculateBlackPoints">
  515. calculateBlackPoints()
  516. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateBlackPoints" class="headerlink"><i class="fas fa-link"></i></a>
  517. </h4>
  518. <aside class="phpdocumentor-element-found-in">
  519. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  520. :
  521. <span class="phpdocumentor-element-found-in__line">207</span>
  522. </aside>
  523. <p class="phpdocumentor-summary">Calculates a single black point for each block of pixels and saves it away.</p>
  524. <code class="phpdocumentor-code phpdocumentor-signature ">
  525. <span class="phpdocumentor-signature__visibility">private</span>
  526. <span class="phpdocumentor-signature__name">calculateBlackPoints</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$subWidth</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$subHeight</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
  527. <div class="phpdocumentor-label-line">
  528. </div>
  529. <section class="phpdocumentor-description"><p>See the following thread for a discussion of this algorithm:</p>
  530. </section>
  531. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  532. <dl class="phpdocumentor-argument-list">
  533. <dt class="phpdocumentor-argument-list__entry">
  534. <span class="phpdocumentor-signature__argument__name">$subWidth</span>
  535. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  536. </dt>
  537. <dd class="phpdocumentor-argument-list__definition">
  538. </dd>
  539. <dt class="phpdocumentor-argument-list__entry">
  540. <span class="phpdocumentor-signature__argument__name">$subHeight</span>
  541. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  542. </dt>
  543. <dd class="phpdocumentor-argument-list__definition">
  544. </dd>
  545. <dt class="phpdocumentor-argument-list__entry">
  546. <span class="phpdocumentor-signature__argument__name">$width</span>
  547. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  548. </dt>
  549. <dd class="phpdocumentor-argument-list__definition">
  550. </dd>
  551. <dt class="phpdocumentor-argument-list__entry">
  552. <span class="phpdocumentor-signature__argument__name">$height</span>
  553. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  554. </dt>
  555. <dd class="phpdocumentor-argument-list__definition">
  556. </dd>
  557. </dl>
  558. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  559. Tags
  560. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateBlackPoints#tags" class="headerlink"><i class="fas fa-link"></i></a>
  561. </h5>
  562. <dl class="phpdocumentor-tag-list">
  563. <dt class="phpdocumentor-tag-list__entry">
  564. <span class="phpdocumentor-tag__name">see</span>
  565. </dt>
  566. <dd class="phpdocumentor-tag-list__definition">
  567. <span class="phpdocumentor-tag-link"><a href="http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0">http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0</a></span>
  568. </dd>
  569. </dl>
  570. <section>
  571. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  572. <span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
  573. </section>
  574. </article>
  575. <article
  576. class="phpdocumentor-element
  577. -method
  578. -private
  579. "
  580. >
  581. <h4 class="phpdocumentor-element__name" id="method_calculateThresholdForBlock">
  582. calculateThresholdForBlock()
  583. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateThresholdForBlock" class="headerlink"><i class="fas fa-link"></i></a>
  584. </h4>
  585. <aside class="phpdocumentor-element-found-in">
  586. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  587. :
  588. <span class="phpdocumentor-element-found-in__line">298</span>
  589. </aside>
  590. <p class="phpdocumentor-summary">For each block in the image, calculate the average black point using a 5x5 grid
  591. of the surrounding blocks. Also handles the corner cases (fractional blocks are computed based
  592. on the last pixels in the row/column which are also used in the previous block).</p>
  593. <code class="phpdocumentor-code phpdocumentor-signature ">
  594. <span class="phpdocumentor-signature__visibility">private</span>
  595. <span class="phpdocumentor-signature__name">calculateThresholdForBlock</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$subWidth</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$subHeight</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span></code>
  596. <div class="phpdocumentor-label-line">
  597. </div>
  598. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  599. <dl class="phpdocumentor-argument-list">
  600. <dt class="phpdocumentor-argument-list__entry">
  601. <span class="phpdocumentor-signature__argument__name">$subWidth</span>
  602. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  603. </dt>
  604. <dd class="phpdocumentor-argument-list__definition">
  605. </dd>
  606. <dt class="phpdocumentor-argument-list__entry">
  607. <span class="phpdocumentor-signature__argument__name">$subHeight</span>
  608. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  609. </dt>
  610. <dd class="phpdocumentor-argument-list__definition">
  611. </dd>
  612. <dt class="phpdocumentor-argument-list__entry">
  613. <span class="phpdocumentor-signature__argument__name">$width</span>
  614. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  615. </dt>
  616. <dd class="phpdocumentor-argument-list__definition">
  617. </dd>
  618. <dt class="phpdocumentor-argument-list__entry">
  619. <span class="phpdocumentor-signature__argument__name">$height</span>
  620. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  621. </dt>
  622. <dd class="phpdocumentor-argument-list__definition">
  623. </dd>
  624. </dl>
  625. <section>
  626. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  627. <span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span>
  628. </section>
  629. </article>
  630. <article
  631. class="phpdocumentor-element
  632. -method
  633. -private
  634. "
  635. >
  636. <h4 class="phpdocumentor-element__name" id="method_cap">
  637. cap()
  638. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_cap" class="headerlink"><i class="fas fa-link"></i></a>
  639. </h4>
  640. <aside class="phpdocumentor-element-found-in">
  641. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  642. :
  643. <span class="phpdocumentor-element-found-in__line">347</span>
  644. </aside>
  645. <code class="phpdocumentor-code phpdocumentor-signature ">
  646. <span class="phpdocumentor-signature__visibility">private</span>
  647. <span class="phpdocumentor-signature__name">cap</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$value</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$min</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$max</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  648. <div class="phpdocumentor-label-line">
  649. </div>
  650. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  651. <dl class="phpdocumentor-argument-list">
  652. <dt class="phpdocumentor-argument-list__entry">
  653. <span class="phpdocumentor-signature__argument__name">$value</span>
  654. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  655. </dt>
  656. <dd class="phpdocumentor-argument-list__definition">
  657. </dd>
  658. <dt class="phpdocumentor-argument-list__entry">
  659. <span class="phpdocumentor-signature__argument__name">$min</span>
  660. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  661. </dt>
  662. <dd class="phpdocumentor-argument-list__definition">
  663. </dd>
  664. <dt class="phpdocumentor-argument-list__entry">
  665. <span class="phpdocumentor-signature__argument__name">$max</span>
  666. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  667. </dt>
  668. <dd class="phpdocumentor-argument-list__definition">
  669. </dd>
  670. </dl>
  671. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  672. Tags
  673. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_cap#tags" class="headerlink"><i class="fas fa-link"></i></a>
  674. </h5>
  675. <dl class="phpdocumentor-tag-list">
  676. <dt class="phpdocumentor-tag-list__entry">
  677. <span class="phpdocumentor-tag__name">noinspection</span>
  678. </dt>
  679. <dd class="phpdocumentor-tag-list__definition">
  680. <section class="phpdocumentor-description"><p>PhpSameParameterValueInspection</p>
  681. </section>
  682. </dd>
  683. </dl>
  684. <section>
  685. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  686. <span class="phpdocumentor-signature__response_type">int</span>
  687. </section>
  688. </article>
  689. <article
  690. class="phpdocumentor-element
  691. -method
  692. -private
  693. "
  694. >
  695. <h4 class="phpdocumentor-element__name" id="method_estimateBlackPoint">
  696. estimateBlackPoint()
  697. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_estimateBlackPoint" class="headerlink"><i class="fas fa-link"></i></a>
  698. </h4>
  699. <aside class="phpdocumentor-element-found-in">
  700. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  701. :
  702. <span class="phpdocumentor-element-found-in__line">62</span>
  703. </aside>
  704. <code class="phpdocumentor-code phpdocumentor-signature ">
  705. <span class="phpdocumentor-signature__visibility">private</span>
  706. <span class="phpdocumentor-signature__name">estimateBlackPoint</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$buckets</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int</span></code>
  707. <div class="phpdocumentor-label-line">
  708. </div>
  709. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  710. <dl class="phpdocumentor-argument-list">
  711. <dt class="phpdocumentor-argument-list__entry">
  712. <span class="phpdocumentor-signature__argument__name">$buckets</span>
  713. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
  714. </dt>
  715. <dd class="phpdocumentor-argument-list__definition">
  716. </dd>
  717. </dl>
  718. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  719. Tags
  720. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_estimateBlackPoint#tags" class="headerlink"><i class="fas fa-link"></i></a>
  721. </h5>
  722. <dl class="phpdocumentor-tag-list">
  723. <dt class="phpdocumentor-tag-list__entry">
  724. <span class="phpdocumentor-tag__name">throws</span>
  725. </dt>
  726. <dd class="phpdocumentor-tag-list__definition">
  727. <span class="phpdocumentor-tag-link"><a href="classes/chillerlan-QRCode-Decoder-QRCodeDecoderException.html"><abbr title="\chillerlan\QRCode\Decoder\QRCodeDecoderException">QRCodeDecoderException</abbr></a></span>
  728. </dd>
  729. </dl>
  730. <section>
  731. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  732. <span class="phpdocumentor-signature__response_type">int</span>
  733. </section>
  734. </article>
  735. <article
  736. class="phpdocumentor-element
  737. -method
  738. -private
  739. "
  740. >
  741. <h4 class="phpdocumentor-element__name" id="method_getHistogramBlackMatrix">
  742. getHistogramBlackMatrix()
  743. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_getHistogramBlackMatrix" class="headerlink"><i class="fas fa-link"></i></a>
  744. </h4>
  745. <aside class="phpdocumentor-element-found-in">
  746. <abbr class="phpdocumentor-element-found-in__file" title="src/Decoder/Binarizer.php"><a href="files/src-decoder-binarizer.html"><abbr title="src/Decoder/Binarizer.php">Binarizer.php</abbr></a></abbr>
  747. :
  748. <span class="phpdocumentor-element-found-in__line">165</span>
  749. </aside>
  750. <code class="phpdocumentor-code phpdocumentor-signature ">
  751. <span class="phpdocumentor-signature__visibility">private</span>
  752. <span class="phpdocumentor-signature__name">getHistogramBlackMatrix</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$width</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$height</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span></code>
  753. <div class="phpdocumentor-label-line">
  754. </div>
  755. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  756. <dl class="phpdocumentor-argument-list">
  757. <dt class="phpdocumentor-argument-list__entry">
  758. <span class="phpdocumentor-signature__argument__name">$width</span>
  759. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  760. </dt>
  761. <dd class="phpdocumentor-argument-list__definition">
  762. </dd>
  763. <dt class="phpdocumentor-argument-list__entry">
  764. <span class="phpdocumentor-signature__argument__name">$height</span>
  765. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  766. </dt>
  767. <dd class="phpdocumentor-argument-list__definition">
  768. </dd>
  769. </dl>
  770. <section>
  771. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  772. <span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span>
  773. </section>
  774. </article>
  775. </section>
  776. <div class="phpdocumentor-modal" id="source-view">
  777. <div class="phpdocumentor-modal-bg" data-exit-button></div>
  778. <div class="phpdocumentor-modal-container">
  779. <div class="phpdocumentor-modal-content">
  780. <pre style="max-height: 500px; overflow-y: scroll" data-src="files/src/Decoder/Binarizer.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
  781. </div>
  782. <button data-exit-button class="phpdocumentor-modal__close">&times;</button>
  783. </div>
  784. </div>
  785. <script type="text/javascript">
  786. (function () {
  787. function loadExternalCodeSnippet(el, url, line) {
  788. Array.prototype.slice.call(el.querySelectorAll('pre[data-src]')).forEach((pre) => {
  789. const src = url || pre.getAttribute('data-src').replace(/\\/g, '/');
  790. const language = 'php';
  791. const code = document.createElement('code');
  792. code.className = 'language-' + language;
  793. pre.textContent = '';
  794. pre.setAttribute('data-line', line)
  795. code.textContent = 'Loading…';
  796. pre.appendChild(code);
  797. var xhr = new XMLHttpRequest();
  798. xhr.open('GET', src, true);
  799. xhr.onreadystatechange = function () {
  800. if (xhr.readyState !== 4) {
  801. return;
  802. }
  803. if (xhr.status < 400 && xhr.responseText) {
  804. code.textContent = xhr.responseText;
  805. Prism.highlightElement(code);
  806. return;
  807. }
  808. if (xhr.status === 404) {
  809. code.textContent = '✖ Error: File could not be found';
  810. return;
  811. }
  812. if (xhr.status >= 400) {
  813. code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
  814. return;
  815. }
  816. code.textContent = '✖ Error: An unknown error occurred';
  817. };
  818. xhr.send(null);
  819. });
  820. }
  821. const modalButtons = document.querySelectorAll("[data-modal]");
  822. const openedAsLocalFile = window.location.protocol === 'file:';
  823. if (modalButtons.length > 0 && openedAsLocalFile) {
  824. console.warn(
  825. 'Viewing the source code is unavailable because you are opening this page from the file:// scheme; ' +
  826. 'browsers block XHR requests when a page is opened this way'
  827. );
  828. }
  829. modalButtons.forEach(function (trigger) {
  830. if (openedAsLocalFile) {
  831. trigger.setAttribute("hidden", "hidden");
  832. }
  833. trigger.addEventListener("click", function (event) {
  834. event.preventDefault();
  835. const modal = document.getElementById(trigger.dataset.modal);
  836. if (!modal) {
  837. console.error(`Modal with id "${trigger.dataset.modal}" could not be found`);
  838. return;
  839. }
  840. modal.classList.add("phpdocumentor-modal__open");
  841. loadExternalCodeSnippet(modal, trigger.dataset.src || null, trigger.dataset.line)
  842. const exits = modal.querySelectorAll("[data-exit-button]");
  843. exits.forEach(function (exit) {
  844. exit.addEventListener("click", function (event) {
  845. event.preventDefault();
  846. modal.classList.remove("phpdocumentor-modal__open");
  847. });
  848. });
  849. });
  850. });
  851. })();
  852. </script>
  853. </article>
  854. </section>
  855. <section class="phpdocumentor-on-this-page__sidebar">
  856. <section class="phpdocumentor-on-this-page__content">
  857. <strong class="phpdocumentor-on-this-page__title">On this page</strong>
  858. <ul class="phpdocumentor-list -clean">
  859. <li class="phpdocumentor-on-this-page-section__title">Table Of Contents</li>
  860. <li>
  861. <ul class="phpdocumentor-list -clean">
  862. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc-constants">Constants</a></li>
  863. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc-properties">Properties</a></li>
  864. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#toc-methods">Methods</a></li>
  865. </ul>
  866. </li>
  867. <li class="phpdocumentor-on-this-page-section__title">Constants</li>
  868. <li>
  869. <ul class="phpdocumentor-list -clean">
  870. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE">BLOCK_SIZE</a></li>
  871. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE_MASK">BLOCK_SIZE_MASK</a></li>
  872. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_BLOCK_SIZE_POWER">BLOCK_SIZE_POWER</a></li>
  873. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_LUMINANCE_BUCKETS">LUMINANCE_BUCKETS</a></li>
  874. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_LUMINANCE_SHIFT">LUMINANCE_SHIFT</a></li>
  875. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_MIN_DYNAMIC_RANGE">MIN_DYNAMIC_RANGE</a></li>
  876. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#constant_MINIMUM_DIMENSION">MINIMUM_DIMENSION</a></li>
  877. </ul>
  878. </li>
  879. <li class="phpdocumentor-on-this-page-section__title">Properties</li>
  880. <li>
  881. <ul class="phpdocumentor-list -clean">
  882. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#property_luminances">$luminances<a href="classes/chillerlan-QRCode-Decoder-Binarizer.html"></li>
  883. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#property_source">$source<a href="classes/chillerlan-QRCode-Decoder-Binarizer.html"></li>
  884. </ul>
  885. </li>
  886. <li class="phpdocumentor-on-this-page-section__title">Methods</li>
  887. <li>
  888. <ul class="phpdocumentor-list -clean">
  889. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method___construct">__construct()</a></li>
  890. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_getBlackMatrix">getBlackMatrix()</a></li>
  891. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateBlackPoints">calculateBlackPoints()</a></li>
  892. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_calculateThresholdForBlock">calculateThresholdForBlock()</a></li>
  893. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_cap">cap()</a></li>
  894. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_estimateBlackPoint">estimateBlackPoint()</a></li>
  895. <li><a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#method_getHistogramBlackMatrix">getHistogramBlackMatrix()</a></li>
  896. </ul>
  897. </li>
  898. </ul>
  899. </section>
  900. </section>
  901. </div>
  902. <section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
  903. <section class="phpdocumentor-search-results__dialog">
  904. <header class="phpdocumentor-search-results__header">
  905. <h2 class="phpdocumentor-search-results__title">Search results</h2>
  906. <button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
  907. </header>
  908. <section class="phpdocumentor-search-results__body">
  909. <ul class="phpdocumentor-search-results__entries"></ul>
  910. </section>
  911. </section>
  912. </section>
  913. </div>
  914. <a href="classes/chillerlan-QRCode-Decoder-Binarizer.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
  915. </main>
  916. <script>
  917. cssVars({});
  918. </script>
  919. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
  920. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
  921. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
  922. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
  923. </body>
  924. </html>