chillerlan-QRCode-Detector-AlignmentPatternFinder.html 42 KB

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