chillerlan-QRCode-Detector-AlignmentPatternFinder.html 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  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=Source+Sans+Pro:wght@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/search.js"></script>
  22. <script defer src="js/searchIndex.js"></script>
  23. </head>
  24. <body id="top">
  25. <header class="phpdocumentor-header phpdocumentor-section">
  26. <h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
  27. <input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
  28. <label class="phpdocumentor-header__menu-icon" for="menu-button">
  29. <i class="fas fa-bars"></i>
  30. </label>
  31. <section data-search-form class="phpdocumentor-search">
  32. <label>
  33. <span class="visually-hidden">Search for</span>
  34. <svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  35. <circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
  36. <line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
  37. </svg>
  38. <input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
  39. </label>
  40. </section>
  41. <nav class="phpdocumentor-topnav">
  42. <ul class="phpdocumentor-topnav__menu">
  43. </ul>
  44. </nav>
  45. </header>
  46. <main class="phpdocumentor">
  47. <div class="phpdocumentor-section">
  48. <input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
  49. <label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
  50. Menu
  51. </label>
  52. <aside class="phpdocumentor-column -four phpdocumentor-sidebar">
  53. <section class="phpdocumentor-sidebar__category">
  54. <h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
  55. <h4 class="phpdocumentor-sidebar__root-namespace"><a href="namespaces/chillerlan.html">chillerlan</a></h4>
  56. <ul class="phpdocumentor-list">
  57. <li>
  58. <a href="namespaces/chillerlan-qrcode.html">QRCode</a>
  59. </li>
  60. <li>
  61. <a href="namespaces/chillerlan-qrcodetest.html">QRCodeTest</a>
  62. </li>
  63. </ul>
  64. </section>
  65. <section class="phpdocumentor-sidebar__category">
  66. <h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
  67. <h4 class="phpdocumentor-sidebar__root-namespace"><a href="packages/Application.html">Application</a></h4>
  68. </section>
  69. <section class="phpdocumentor-sidebar__category">
  70. <h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
  71. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
  72. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
  73. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
  74. </section>
  75. <section class="phpdocumentor-sidebar__category">
  76. <h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
  77. <h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
  78. </section>
  79. </aside>
  80. <div class="phpdocumentor-column -eight phpdocumentor-content">
  81. <ul class="phpdocumentor-breadcrumbs">
  82. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan.html">chillerlan</a></li>
  83. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode.html">QRCode</a></li>
  84. <li class="phpdocumentor-breadcrumb"><a href="namespaces/chillerlan-qrcode-detector.html">Detector</a></li>
  85. </ul>
  86. <article class="phpdocumentor-element -class">
  87. <h2 class="phpdocumentor-content__title">
  88. AlignmentPatternFinder
  89. <div class="phpdocumentor-element__package">
  90. in package
  91. <ul class="phpdocumentor-breadcrumbs">
  92. <li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
  93. </ul>
  94. </div>
  95. </h2>
  96. <aside class="phpdocumentor-element-found-in">
  97. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  98. :
  99. <span class="phpdocumentor-element-found-in__line">31</span>
  100. </aside>
  101. <p class="phpdocumentor-summary">This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder
  102. patterns but are smaller and appear at regular intervals throughout the image.</p>
  103. <section class="phpdocumentor-description"><p>At the moment this only looks for the bottom-right alignment pattern.</p>
  104. <p>This is mostly a simplified copy of FinderPatternFinder. It is copied,
  105. pasted and stripped down here for maximum performance but does unfortunately duplicate
  106. some code.</p>
  107. <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.</p>
  108. </section>
  109. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  110. Tags
  111. <a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
  112. </h5>
  113. <dl class="phpdocumentor-tag-list">
  114. <dt class="phpdocumentor-tag-list__entry">
  115. <span class="phpdocumentor-tag__name">author</span>
  116. </dt>
  117. <dd class="phpdocumentor-tag-list__definition">
  118. <section class="phpdocumentor-description"><p>Sean Owen</p>
  119. </section>
  120. </dd>
  121. </dl>
  122. <h3 id="toc">
  123. Table of Contents
  124. <a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
  125. </h3>
  126. <dl class="phpdocumentor-table-of-contents">
  127. <dt class="phpdocumentor-table-of-contents__entry -property -private">
  128. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#property_bitMatrix">$bitMatrix</a>
  129. <span>
  130. &nbsp;: <a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a> </span>
  131. </dt>
  132. <dd></dd>
  133. <dt class="phpdocumentor-table-of-contents__entry -property -private">
  134. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#property_moduleSize">$moduleSize</a>
  135. <span>
  136. &nbsp;: float </span>
  137. </dt>
  138. <dd></dd>
  139. <dt class="phpdocumentor-table-of-contents__entry -property -private">
  140. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#property_possibleCenters">$possibleCenters</a>
  141. <span>
  142. &nbsp;: array&lt;string|int, mixed&gt; </span>
  143. </dt>
  144. <dd></dd>
  145. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  146. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method___construct">__construct()</a>
  147. <span>
  148. &nbsp;: mixed </span>
  149. </dt>
  150. <dd>Creates a finder that will look in a portion of the whole image.</dd>
  151. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  152. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_find">find()</a>
  153. <span>
  154. &nbsp;: <a href="classes/chillerlan-QRCode-Detector-AlignmentPattern.html"><abbr title="\chillerlan\QRCode\Detector\AlignmentPattern">AlignmentPattern</abbr></a>|null </span>
  155. </dt>
  156. <dd>This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
  157. it&#039;s pretty performance-critical and so is written to be fast foremost.</dd>
  158. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  159. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_centerFromEnd">centerFromEnd()</a>
  160. <span>
  161. &nbsp;: float </span>
  162. </dt>
  163. <dd>Given a count of black/white/black pixels just seen and an end position,
  164. figures the location of the center of this black/white/black run.</dd>
  165. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  166. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_crossCheckVertical">crossCheckVertical()</a>
  167. <span>
  168. &nbsp;: float|null </span>
  169. </dt>
  170. <dd>After a horizontal scan finds a potential alignment pattern, this method
  171. &quot;cross-checks&quot; by scanning down vertically through the center of the possible
  172. alignment pattern to see if the same proportion is detected.</dd>
  173. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  174. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_foundPatternCross">foundPatternCross()</a>
  175. <span>
  176. &nbsp;: bool </span>
  177. </dt>
  178. <dd></dd>
  179. <dt class="phpdocumentor-table-of-contents__entry -method -private">
  180. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_handlePossibleCenter">handlePossibleCenter()</a>
  181. <span>
  182. &nbsp;: <a href="classes/chillerlan-QRCode-Detector-AlignmentPattern.html"><abbr title="\chillerlan\QRCode\Detector\AlignmentPattern">AlignmentPattern</abbr></a>|null </span>
  183. </dt>
  184. <dd>This is called when a horizontal scan finds a possible alignment pattern. It will
  185. cross check with a vertical scan, and if successful, will see if this pattern had been
  186. found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
  187. found the alignment pattern.</dd>
  188. </dl>
  189. <section class="phpdocumentor-properties">
  190. <h3 class="phpdocumentor-elements__header" id="properties">
  191. Properties
  192. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
  193. </h3>
  194. <article
  195. class="
  196. phpdocumentor-element
  197. -property
  198. -private
  199. "
  200. >
  201. <h4 class="phpdocumentor-element__name" id="property_bitMatrix">
  202. $bitMatrix
  203. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#property_bitMatrix" class="headerlink"><i class="fas fa-link"></i></a>
  204. <span class="phpdocumentor-element__modifiers">
  205. </span>
  206. </h4>
  207. <aside class="phpdocumentor-element-found-in">
  208. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  209. :
  210. <span class="phpdocumentor-element-found-in__line">33</span>
  211. </aside>
  212. <code class="phpdocumentor-code phpdocumentor-signature ">
  213. <span class="phpdocumentor-signature__visibility">private</span>
  214. <span class="phpdocumentor-signature__type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span>
  215. <span class="phpdocumentor-signature__name">$bitMatrix</span>
  216. </code>
  217. <section class="phpdocumentor-description"></section>
  218. <section class="phpdocumentor-description"></section>
  219. </article>
  220. <article
  221. class="
  222. phpdocumentor-element
  223. -property
  224. -private
  225. "
  226. >
  227. <h4 class="phpdocumentor-element__name" id="property_moduleSize">
  228. $moduleSize
  229. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#property_moduleSize" class="headerlink"><i class="fas fa-link"></i></a>
  230. <span class="phpdocumentor-element__modifiers">
  231. </span>
  232. </h4>
  233. <aside class="phpdocumentor-element-found-in">
  234. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  235. :
  236. <span class="phpdocumentor-element-found-in__line">34</span>
  237. </aside>
  238. <code class="phpdocumentor-code phpdocumentor-signature ">
  239. <span class="phpdocumentor-signature__visibility">private</span>
  240. <span class="phpdocumentor-signature__type">float</span>
  241. <span class="phpdocumentor-signature__name">$moduleSize</span>
  242. </code>
  243. <section class="phpdocumentor-description"></section>
  244. <section class="phpdocumentor-description"></section>
  245. </article>
  246. <article
  247. class="
  248. phpdocumentor-element
  249. -property
  250. -private
  251. "
  252. >
  253. <h4 class="phpdocumentor-element__name" id="property_possibleCenters">
  254. $possibleCenters
  255. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#property_possibleCenters" class="headerlink"><i class="fas fa-link"></i></a>
  256. <span class="phpdocumentor-element__modifiers">
  257. </span>
  258. </h4>
  259. <aside class="phpdocumentor-element-found-in">
  260. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  261. :
  262. <span class="phpdocumentor-element-found-in__line">36</span>
  263. </aside>
  264. <code class="phpdocumentor-code phpdocumentor-signature ">
  265. <span class="phpdocumentor-signature__visibility">private</span>
  266. <span class="phpdocumentor-signature__type">array&lt;string|int, mixed&gt;</span>
  267. <span class="phpdocumentor-signature__name">$possibleCenters</span>
  268. </code>
  269. </article>
  270. </section>
  271. <section class="phpdocumentor-methods">
  272. <h3 class="phpdocumentor-elements__header" id="methods">
  273. Methods
  274. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
  275. </h3>
  276. <article
  277. class="phpdocumentor-element
  278. -method
  279. -public
  280. "
  281. >
  282. <h4 class="phpdocumentor-element__name" id="method___construct">
  283. __construct()
  284. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
  285. </h4>
  286. <aside class="phpdocumentor-element-found-in">
  287. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  288. :
  289. <span class="phpdocumentor-element-found-in__line">44</span>
  290. </aside>
  291. <p class="phpdocumentor-summary">Creates a finder that will look in a portion of the whole image.</p>
  292. <code class="phpdocumentor-code phpdocumentor-signature ">
  293. <span class="phpdocumentor-signature__visibility">public</span>
  294. <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-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$image</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">float&nbsp;</span><span class="phpdocumentor-signature__argument__name">$moduleSize</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
  295. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  296. <dl class="phpdocumentor-argument-list">
  297. <dt class="phpdocumentor-argument-list__entry">
  298. <span class="phpdocumentor-signature__argument__name">$image</span>
  299. : <span class="phpdocumentor-signature__argument__return-type"><a href="classes/chillerlan-QRCode-Decoder-BitMatrix.html"><abbr title="\chillerlan\QRCode\Decoder\BitMatrix">BitMatrix</abbr></a></span>
  300. </dt>
  301. <dd class="phpdocumentor-argument-list__definition">
  302. <section class="phpdocumentor-description"><p>image to search</p>
  303. </section>
  304. </dd>
  305. <dt class="phpdocumentor-argument-list__entry">
  306. <span class="phpdocumentor-signature__argument__name">$moduleSize</span>
  307. : <span class="phpdocumentor-signature__argument__return-type">float</span>
  308. </dt>
  309. <dd class="phpdocumentor-argument-list__definition">
  310. <section class="phpdocumentor-description"><p>estimated module size so far</p>
  311. </section>
  312. </dd>
  313. </dl>
  314. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  315. <span class="phpdocumentor-signature__response_type">mixed</span>
  316. &mdash;
  317. </article>
  318. <article
  319. class="phpdocumentor-element
  320. -method
  321. -public
  322. "
  323. >
  324. <h4 class="phpdocumentor-element__name" id="method_find">
  325. find()
  326. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_find" class="headerlink"><i class="fas fa-link"></i></a>
  327. </h4>
  328. <aside class="phpdocumentor-element-found-in">
  329. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  330. :
  331. <span class="phpdocumentor-element-found-in__line">61</span>
  332. </aside>
  333. <p class="phpdocumentor-summary">This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
  334. it&#039;s pretty performance-critical and so is written to be fast foremost.</p>
  335. <code class="phpdocumentor-code phpdocumentor-signature ">
  336. <span class="phpdocumentor-signature__visibility">public</span>
  337. <span class="phpdocumentor-signature__name">find</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$startX</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">$startY</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-Detector-AlignmentPattern.html"><abbr title="\chillerlan\QRCode\Detector\AlignmentPattern">AlignmentPattern</abbr></a>|null</span></code>
  338. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  339. <dl class="phpdocumentor-argument-list">
  340. <dt class="phpdocumentor-argument-list__entry">
  341. <span class="phpdocumentor-signature__argument__name">$startX</span>
  342. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  343. </dt>
  344. <dd class="phpdocumentor-argument-list__definition">
  345. <section class="phpdocumentor-description"><p>left column from which to start searching</p>
  346. </section>
  347. </dd>
  348. <dt class="phpdocumentor-argument-list__entry">
  349. <span class="phpdocumentor-signature__argument__name">$startY</span>
  350. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  351. </dt>
  352. <dd class="phpdocumentor-argument-list__definition">
  353. <section class="phpdocumentor-description"><p>top row from which to start searching</p>
  354. </section>
  355. </dd>
  356. <dt class="phpdocumentor-argument-list__entry">
  357. <span class="phpdocumentor-signature__argument__name">$width</span>
  358. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  359. </dt>
  360. <dd class="phpdocumentor-argument-list__definition">
  361. <section class="phpdocumentor-description"><p>width of region to search</p>
  362. </section>
  363. </dd>
  364. <dt class="phpdocumentor-argument-list__entry">
  365. <span class="phpdocumentor-signature__argument__name">$height</span>
  366. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  367. </dt>
  368. <dd class="phpdocumentor-argument-list__definition">
  369. <section class="phpdocumentor-description"><p>height of region to search</p>
  370. </section>
  371. </dd>
  372. </dl>
  373. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  374. <span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Detector-AlignmentPattern.html"><abbr title="\chillerlan\QRCode\Detector\AlignmentPattern">AlignmentPattern</abbr></a>|null</span>
  375. &mdash;
  376. </article>
  377. <article
  378. class="phpdocumentor-element
  379. -method
  380. -private
  381. "
  382. >
  383. <h4 class="phpdocumentor-element__name" id="method_centerFromEnd">
  384. centerFromEnd()
  385. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_centerFromEnd" class="headerlink"><i class="fas fa-link"></i></a>
  386. </h4>
  387. <aside class="phpdocumentor-element-found-in">
  388. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  389. :
  390. <span class="phpdocumentor-element-found-in__line">209</span>
  391. </aside>
  392. <p class="phpdocumentor-summary">Given a count of black/white/black pixels just seen and an end position,
  393. figures the location of the center of this black/white/black run.</p>
  394. <code class="phpdocumentor-code phpdocumentor-signature ">
  395. <span class="phpdocumentor-signature__visibility">private</span>
  396. <span class="phpdocumentor-signature__name">centerFromEnd</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">$stateCount</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">$end</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">float</span></code>
  397. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  398. <dl class="phpdocumentor-argument-list">
  399. <dt class="phpdocumentor-argument-list__entry">
  400. <span class="phpdocumentor-signature__argument__name">$stateCount</span>
  401. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, int&gt;</span>
  402. </dt>
  403. <dd class="phpdocumentor-argument-list__definition">
  404. </dd>
  405. <dt class="phpdocumentor-argument-list__entry">
  406. <span class="phpdocumentor-signature__argument__name">$end</span>
  407. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  408. </dt>
  409. <dd class="phpdocumentor-argument-list__definition">
  410. </dd>
  411. </dl>
  412. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  413. <span class="phpdocumentor-signature__response_type">float</span>
  414. &mdash;
  415. </article>
  416. <article
  417. class="phpdocumentor-element
  418. -method
  419. -private
  420. "
  421. >
  422. <h4 class="phpdocumentor-element__name" id="method_crossCheckVertical">
  423. crossCheckVertical()
  424. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_crossCheckVertical" class="headerlink"><i class="fas fa-link"></i></a>
  425. </h4>
  426. <aside class="phpdocumentor-element-found-in">
  427. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  428. :
  429. <span class="phpdocumentor-element-found-in__line">226</span>
  430. </aside>
  431. <p class="phpdocumentor-summary">After a horizontal scan finds a potential alignment pattern, this method
  432. &quot;cross-checks&quot; by scanning down vertically through the center of the possible
  433. alignment pattern to see if the same proportion is detected.</p>
  434. <code class="phpdocumentor-code phpdocumentor-signature ">
  435. <span class="phpdocumentor-signature__visibility">private</span>
  436. <span class="phpdocumentor-signature__name">crossCheckVertical</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$startI</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">$centerJ</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">$maxCount</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">$originalStateCountTotal</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">float|null</span></code>
  437. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  438. <dl class="phpdocumentor-argument-list">
  439. <dt class="phpdocumentor-argument-list__entry">
  440. <span class="phpdocumentor-signature__argument__name">$startI</span>
  441. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  442. </dt>
  443. <dd class="phpdocumentor-argument-list__definition">
  444. <section class="phpdocumentor-description"><p>row where an alignment pattern was detected</p>
  445. </section>
  446. </dd>
  447. <dt class="phpdocumentor-argument-list__entry">
  448. <span class="phpdocumentor-signature__argument__name">$centerJ</span>
  449. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  450. </dt>
  451. <dd class="phpdocumentor-argument-list__definition">
  452. <section class="phpdocumentor-description"><p>center of the section that appears to cross an alignment pattern</p>
  453. </section>
  454. </dd>
  455. <dt class="phpdocumentor-argument-list__entry">
  456. <span class="phpdocumentor-signature__argument__name">$maxCount</span>
  457. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  458. </dt>
  459. <dd class="phpdocumentor-argument-list__definition">
  460. <section class="phpdocumentor-description"><p>maximum reasonable number of modules that should be
  461. observed in any reading state, based on the results of the horizontal scan</p>
  462. </section>
  463. </dd>
  464. <dt class="phpdocumentor-argument-list__entry">
  465. <span class="phpdocumentor-signature__argument__name">$originalStateCountTotal</span>
  466. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  467. </dt>
  468. <dd class="phpdocumentor-argument-list__definition">
  469. </dd>
  470. </dl>
  471. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  472. <span class="phpdocumentor-signature__response_type">float|null</span>
  473. &mdash;
  474. <section class="phpdocumentor-description"><p>vertical center of alignment pattern, or null if not found</p>
  475. </section>
  476. </article>
  477. <article
  478. class="phpdocumentor-element
  479. -method
  480. -private
  481. "
  482. >
  483. <h4 class="phpdocumentor-element__name" id="method_foundPatternCross">
  484. foundPatternCross()
  485. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_foundPatternCross" class="headerlink"><i class="fas fa-link"></i></a>
  486. </h4>
  487. <aside class="phpdocumentor-element-found-in">
  488. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  489. :
  490. <span class="phpdocumentor-element-found-in__line">152</span>
  491. </aside>
  492. <code class="phpdocumentor-code phpdocumentor-signature ">
  493. <span class="phpdocumentor-signature__visibility">private</span>
  494. <span class="phpdocumentor-signature__name">foundPatternCross</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">$stateCount</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
  495. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  496. <dl class="phpdocumentor-argument-list">
  497. <dt class="phpdocumentor-argument-list__entry">
  498. <span class="phpdocumentor-signature__argument__name">$stateCount</span>
  499. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, int&gt;</span>
  500. </dt>
  501. <dd class="phpdocumentor-argument-list__definition">
  502. <section class="phpdocumentor-description"><p>count of black/white/black pixels just read</p>
  503. </section>
  504. </dd>
  505. </dl>
  506. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  507. <span class="phpdocumentor-signature__response_type">bool</span>
  508. &mdash;
  509. <section class="phpdocumentor-description"><p>true if the proportions of the counts is close enough to the 1/1/1 ratios
  510. used by alignment patterns to be considered a match</p>
  511. </section>
  512. </article>
  513. <article
  514. class="phpdocumentor-element
  515. -method
  516. -private
  517. "
  518. >
  519. <h4 class="phpdocumentor-element__name" id="method_handlePossibleCenter">
  520. handlePossibleCenter()
  521. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#method_handlePossibleCenter" class="headerlink"><i class="fas fa-link"></i></a>
  522. </h4>
  523. <aside class="phpdocumentor-element-found-in">
  524. <abbr class="phpdocumentor-element-found-in__file" title="src/Detector/AlignmentPatternFinder.php"><a href="files/src-detector-alignmentpatternfinder.html"><abbr title="src/Detector/AlignmentPatternFinder.php">AlignmentPatternFinder.php</abbr></a></abbr>
  525. :
  526. <span class="phpdocumentor-element-found-in__line">177</span>
  527. </aside>
  528. <p class="phpdocumentor-summary">This is called when a horizontal scan finds a possible alignment pattern. It will
  529. cross check with a vertical scan, and if successful, will see if this pattern had been
  530. found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
  531. found the alignment pattern.</p>
  532. <code class="phpdocumentor-code phpdocumentor-signature ">
  533. <span class="phpdocumentor-signature__visibility">private</span>
  534. <span class="phpdocumentor-signature__name">handlePossibleCenter</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">$stateCount</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">$i</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">$j</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Detector-AlignmentPattern.html"><abbr title="\chillerlan\QRCode\Detector\AlignmentPattern">AlignmentPattern</abbr></a>|null</span></code>
  535. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  536. <dl class="phpdocumentor-argument-list">
  537. <dt class="phpdocumentor-argument-list__entry">
  538. <span class="phpdocumentor-signature__argument__name">$stateCount</span>
  539. : <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, int&gt;</span>
  540. </dt>
  541. <dd class="phpdocumentor-argument-list__definition">
  542. <section class="phpdocumentor-description"><p>reading state module counts from horizontal scan</p>
  543. </section>
  544. </dd>
  545. <dt class="phpdocumentor-argument-list__entry">
  546. <span class="phpdocumentor-signature__argument__name">$i</span>
  547. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  548. </dt>
  549. <dd class="phpdocumentor-argument-list__definition">
  550. <section class="phpdocumentor-description"><p>row where alignment pattern may be found</p>
  551. </section>
  552. </dd>
  553. <dt class="phpdocumentor-argument-list__entry">
  554. <span class="phpdocumentor-signature__argument__name">$j</span>
  555. : <span class="phpdocumentor-signature__argument__return-type">int</span>
  556. </dt>
  557. <dd class="phpdocumentor-argument-list__definition">
  558. <section class="phpdocumentor-description"><p>end of possible alignment pattern in row</p>
  559. </section>
  560. </dd>
  561. </dl>
  562. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  563. <span class="phpdocumentor-signature__response_type"><a href="classes/chillerlan-QRCode-Detector-AlignmentPattern.html"><abbr title="\chillerlan\QRCode\Detector\AlignmentPattern">AlignmentPattern</abbr></a>|null</span>
  564. &mdash;
  565. <section class="phpdocumentor-description"><p>if we have found the same pattern twice, or null if not</p>
  566. </section>
  567. </article>
  568. </section>
  569. <script type="text/javascript">
  570. function loadExternalCodeSnippets(line) {
  571. Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
  572. var src = pre.getAttribute('data-src').replace( /\\/g, '/');
  573. var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
  574. var language = 'php';
  575. var code = document.createElement('code');
  576. code.className = 'language-' + language;
  577. pre.textContent = '';
  578. pre.setAttribute('data-line', line)
  579. code.textContent = 'Loading…';
  580. pre.appendChild(code);
  581. var xhr = new XMLHttpRequest();
  582. xhr.open('GET', src, true);
  583. xhr.onreadystatechange = function () {
  584. if (xhr.readyState == 4) {
  585. if (xhr.status < 400 && xhr.responseText) {
  586. code.textContent = xhr.responseText;
  587. Prism.highlightElement(code);
  588. }
  589. else if (xhr.status >= 400) {
  590. code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
  591. }
  592. else {
  593. code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
  594. }
  595. }
  596. };
  597. xhr.send(null);
  598. });
  599. }
  600. var modals = document.querySelectorAll("[data-modal]");
  601. modals.forEach(function (trigger) {
  602. trigger.addEventListener("click", function (event) {
  603. //event.preventDefault();
  604. const modal = document.getElementById(trigger.dataset.modal);
  605. modal.classList.add("phpdocumentor-modal__open");
  606. loadExternalCodeSnippets(trigger.dataset.line)
  607. const exits = modal.querySelectorAll("[data-exit-button]");
  608. exits.forEach(function (exit) {
  609. exit.addEventListener("click", function (event) {
  610. event.preventDefault();
  611. modal.classList.remove("phpdocumentor-modal__open");
  612. });
  613. });
  614. });
  615. });
  616. </script>
  617. </article>
  618. <section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
  619. <section class="phpdocumentor-search-results__dialog">
  620. <header class="phpdocumentor-search-results__header">
  621. <h2 class="phpdocumentor-search-results__title">Search results</h2>
  622. <button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
  623. </header>
  624. <section class="phpdocumentor-search-results__body">
  625. <ul class="phpdocumentor-search-results__entries"></ul>
  626. </section>
  627. </section>
  628. </section>
  629. </div>
  630. </div>
  631. <a href="classes/chillerlan-QRCode-Detector-AlignmentPatternFinder.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
  632. </main>
  633. <script>
  634. cssVars({});
  635. </script>
  636. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
  637. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
  638. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
  639. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
  640. </body>
  641. </html>