chillerlan-QRCode-Decoder-Binarizer.html 60 KB

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