chillerlan-QRCode-Detector-AlignmentPatternFinder.html 42 KB

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