zxing_cpp_no_cmake 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.gitmodules +0 -0
  4. data/CHANGELOG.rdoc +6 -0
  5. data/Gemfile +3 -0
  6. data/Manifest.txt +375 -0
  7. data/README.rdoc +141 -0
  8. data/Rakefile +28 -0
  9. data/bin/zxd +87 -0
  10. data/bin/zxe +53 -0
  11. data/ext/zxing/extconf.rb +20 -0
  12. data/ext/zxing/zxing-cpp/.gitignore +2 -0
  13. data/ext/zxing/zxing-cpp/AUTHORS +115 -0
  14. data/ext/zxing/zxing-cpp/CMakeLists.txt +89 -0
  15. data/ext/zxing/zxing-cpp/COPYING +201 -0
  16. data/ext/zxing/zxing-cpp/NOTICE +65 -0
  17. data/ext/zxing/zxing-cpp/README.md +45 -0
  18. data/ext/zxing/zxing-cpp/build/CMakeCache.txt +382 -0
  19. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCCompiler.cmake +76 -0
  20. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCXXCompiler.cmake +79 -0
  21. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_C.bin +0 -0
  22. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
  23. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeSystem.cmake +15 -0
  24. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/CMakeCCompilerId.c +665 -0
  25. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/a.out +0 -0
  26. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +644 -0
  27. data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/a.out +0 -0
  28. data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  29. data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeOutput.log +447 -0
  30. data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile.cmake +125 -0
  31. data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile2 +177 -0
  32. data/ext/zxing/zxing-cpp/build/CMakeFiles/TargetDirectories.txt +9 -0
  33. data/ext/zxing/zxing-cpp/build/CMakeFiles/cmake.check_cache +1 -0
  34. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/CXX.includecache +1892 -0
  35. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/DependInfo.cmake +120 -0
  36. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/build.make +1584 -0
  37. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean.cmake +109 -0
  38. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean_target.cmake +3 -0
  39. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.internal +1465 -0
  40. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.make +1465 -0
  41. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/flags.make +10 -0
  42. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/link.txt +2 -0
  43. data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/progress.make +102 -0
  44. data/ext/zxing/zxing-cpp/build/CMakeFiles/progress.marks +1 -0
  45. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/CXX.includecache +344 -0
  46. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/DependInfo.cmake +33 -0
  47. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/build.make +266 -0
  48. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/cmake_clean.cmake +21 -0
  49. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.internal +103 -0
  50. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.make +103 -0
  51. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/flags.make +10 -0
  52. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/link.txt +1 -0
  53. data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/progress.make +14 -0
  54. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/CXX.includecache +378 -0
  55. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/DependInfo.cmake +25 -0
  56. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/build.make +145 -0
  57. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/cmake_clean.cmake +13 -0
  58. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.internal +53 -0
  59. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.make +53 -0
  60. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/flags.make +10 -0
  61. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/link.txt +1 -0
  62. data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/progress.make +6 -0
  63. data/ext/zxing/zxing-cpp/build/Makefile +3706 -0
  64. data/ext/zxing/zxing-cpp/build/cmake_install.cmake +73 -0
  65. data/ext/zxing/zxing-cpp/build/libzxing.a +0 -0
  66. data/ext/zxing/zxing-cpp/build/testrunner +0 -0
  67. data/ext/zxing/zxing-cpp/build/zxing +0 -0
  68. data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +113 -0
  69. data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.h +40 -0
  70. data/ext/zxing/zxing-cpp/cli/src/jpgd.cpp +3174 -0
  71. data/ext/zxing/zxing-cpp/cli/src/jpgd.h +319 -0
  72. data/ext/zxing/zxing-cpp/cli/src/lodepng.cpp +6261 -0
  73. data/ext/zxing/zxing-cpp/cli/src/lodepng.h +1695 -0
  74. data/ext/zxing/zxing-cpp/cli/src/main.cpp +297 -0
  75. data/ext/zxing/zxing-cpp/cmake/FindCPPUNIT.cmake +54 -0
  76. data/ext/zxing/zxing-cpp/cmake/FindIconv.cmake +57 -0
  77. data/ext/zxing/zxing-cpp/core/src/bigint/.gitignore +6 -0
  78. data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.cc +405 -0
  79. data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.hh +215 -0
  80. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.cc +70 -0
  81. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.hh +25 -0
  82. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerLibrary.hh +8 -0
  83. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.cc +50 -0
  84. data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.hh +72 -0
  85. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.cc +697 -0
  86. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.hh +418 -0
  87. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.cc +125 -0
  88. data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.hh +122 -0
  89. data/ext/zxing/zxing-cpp/core/src/bigint/ChangeLog +146 -0
  90. data/ext/zxing/zxing-cpp/core/src/bigint/Makefile +73 -0
  91. data/ext/zxing/zxing-cpp/core/src/bigint/NumberlikeArray.hh +177 -0
  92. data/ext/zxing/zxing-cpp/core/src/bigint/README +71 -0
  93. data/ext/zxing/zxing-cpp/core/src/win32/zxing/iconv.h +14 -0
  94. data/ext/zxing/zxing-cpp/core/src/win32/zxing/stdint.h +247 -0
  95. data/ext/zxing/zxing-cpp/core/src/win32/zxing/win_iconv.c +2035 -0
  96. data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.cpp +40 -0
  97. data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.h +60 -0
  98. data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.cpp +45 -0
  99. data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.h +50 -0
  100. data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.cpp +70 -0
  101. data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.h +56 -0
  102. data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.cpp +28 -0
  103. data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.h +34 -0
  104. data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.cpp +142 -0
  105. data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.h +85 -0
  106. data/ext/zxing/zxing-cpp/core/src/zxing/Exception.cpp +43 -0
  107. data/ext/zxing/zxing-cpp/core/src/zxing/Exception.h +51 -0
  108. data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.cpp +41 -0
  109. data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.h +37 -0
  110. data/ext/zxing/zxing-cpp/core/src/zxing/IllegalStateException.h +35 -0
  111. data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.cpp +68 -0
  112. data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.h +48 -0
  113. data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.cpp +86 -0
  114. data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.h +59 -0
  115. data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.cpp +124 -0
  116. data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.h +48 -0
  117. data/ext/zxing/zxing-cpp/core/src/zxing/NotFoundException.h +35 -0
  118. data/ext/zxing/zxing-cpp/core/src/zxing/Reader.cpp +31 -0
  119. data/ext/zxing/zxing-cpp/core/src/zxing/Reader.h +40 -0
  120. data/ext/zxing/zxing-cpp/core/src/zxing/ReaderException.h +37 -0
  121. data/ext/zxing/zxing-cpp/core/src/zxing/Result.cpp +61 -0
  122. data/ext/zxing/zxing-cpp/core/src/zxing/Result.h +55 -0
  123. data/ext/zxing/zxing-cpp/core/src/zxing/ResultIO.cpp +34 -0
  124. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.cpp +108 -0
  125. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.h +55 -0
  126. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.cpp +26 -0
  127. data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.h +39 -0
  128. data/ext/zxing/zxing-cpp/core/src/zxing/ZXing.h +133 -0
  129. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.cpp +54 -0
  130. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.h +48 -0
  131. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.cpp +68 -0
  132. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.h +49 -0
  133. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.cpp +489 -0
  134. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.h +69 -0
  135. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.cpp +548 -0
  136. data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.h +92 -0
  137. data/ext/zxing/zxing-cpp/core/src/zxing/common/Array.h +170 -0
  138. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.cpp +155 -0
  139. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.h +81 -0
  140. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArrayIO.cpp +31 -0
  141. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.cpp +143 -0
  142. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.h +91 -0
  143. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.cpp +76 -0
  144. data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.h +74 -0
  145. data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.cpp +105 -0
  146. data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.h +53 -0
  147. data/ext/zxing/zxing-cpp/core/src/zxing/common/Counted.h +140 -0
  148. data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.cpp +46 -0
  149. data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.h +51 -0
  150. data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.cpp +39 -0
  151. data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.h +43 -0
  152. data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +212 -0
  153. data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +48 -0
  154. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp +80 -0
  155. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.h +53 -0
  156. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.cpp +81 -0
  157. data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.h +46 -0
  158. data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.cpp +122 -0
  159. data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.h +45 -0
  160. data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.cpp +226 -0
  161. data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.h +67 -0
  162. data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.cpp +27 -0
  163. data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.h +36 -0
  164. data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.cpp +107 -0
  165. data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.h +49 -0
  166. data/ext/zxing/zxing-cpp/core/src/zxing/common/Point.h +47 -0
  167. data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.cpp +61 -0
  168. data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.h +51 -0
  169. data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.cpp +198 -0
  170. data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.h +52 -0
  171. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/JavaMath.h +43 -0
  172. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MathUtils.h +57 -0
  173. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.cpp +175 -0
  174. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.h +62 -0
  175. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.cpp +330 -0
  176. data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.h +59 -0
  177. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp +150 -0
  178. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.h +73 -0
  179. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp +218 -0
  180. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +56 -0
  181. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp +174 -0
  182. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h +49 -0
  183. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp +30 -0
  184. data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h +33 -0
  185. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.cpp +54 -0
  186. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.h +45 -0
  187. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.cpp +199 -0
  188. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.h +87 -0
  189. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.cpp +361 -0
  190. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.h +59 -0
  191. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.cpp +113 -0
  192. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.h +49 -0
  193. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.cpp +415 -0
  194. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.h +104 -0
  195. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.cpp +93 -0
  196. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.h +49 -0
  197. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.cpp +46 -0
  198. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.h +43 -0
  199. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.cpp +447 -0
  200. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.h +94 -0
  201. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.cpp +23 -0
  202. data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.h +23 -0
  203. data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.cpp +75 -0
  204. data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.h +42 -0
  205. data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.cpp +137 -0
  206. data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.h +51 -0
  207. data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.cpp +29 -0
  208. data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.h +41 -0
  209. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.cpp +58 -0
  210. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +36 -0
  211. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.cpp +47 -0
  212. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +37 -0
  213. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +236 -0
  214. data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +47 -0
  215. data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.cpp +340 -0
  216. data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.h +57 -0
  217. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.cpp +497 -0
  218. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.h +48 -0
  219. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.cpp +329 -0
  220. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.h +63 -0
  221. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.cpp +303 -0
  222. data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.h +58 -0
  223. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.cpp +85 -0
  224. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.h +49 -0
  225. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.cpp +65 -0
  226. data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.h +47 -0
  227. data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.cpp +337 -0
  228. data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.h +54 -0
  229. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.cpp +96 -0
  230. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.h +38 -0
  231. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.cpp +110 -0
  232. data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +41 -0
  233. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.cpp +228 -0
  234. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.h +81 -0
  235. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.cpp +28 -0
  236. data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.h +35 -0
  237. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.cpp +70 -0
  238. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.h +50 -0
  239. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.cpp +309 -0
  240. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.h +88 -0
  241. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.cpp +146 -0
  242. data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.h +47 -0
  243. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.cpp +170 -0
  244. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.h +49 -0
  245. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.cpp +997 -0
  246. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.h +84 -0
  247. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.cpp +563 -0
  248. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.h +84 -0
  249. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.cpp +118 -0
  250. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.h +62 -0
  251. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp +214 -0
  252. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.h +71 -0
  253. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.cpp +120 -0
  254. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.h +72 -0
  255. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp +284 -0
  256. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.h +68 -0
  257. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.cpp +665 -0
  258. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.h +106 -0
  259. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.cpp +715 -0
  260. data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.h +122 -0
  261. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.cpp +65 -0
  262. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.h +52 -0
  263. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.cpp +117 -0
  264. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.h +54 -0
  265. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.cpp +52 -0
  266. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.h +48 -0
  267. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.cpp +560 -0
  268. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.h +85 -0
  269. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.cpp +183 -0
  270. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.h +56 -0
  271. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp +118 -0
  272. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.h +50 -0
  273. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.cpp +159 -0
  274. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.h +50 -0
  275. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +428 -0
  276. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.h +72 -0
  277. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.cpp +107 -0
  278. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.h +46 -0
  279. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.cpp +90 -0
  280. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.h +57 -0
  281. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp +47 -0
  282. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.h +45 -0
  283. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +208 -0
  284. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.h +68 -0
  285. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.cpp +315 -0
  286. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.h +69 -0
  287. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.cpp +69 -0
  288. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.h +48 -0
  289. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.cpp +559 -0
  290. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h +76 -0
  291. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp +41 -0
  292. data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h +47 -0
  293. data/ext/zxing/zxing-cpp/core/tests/src/TestRunner.cpp +30 -0
  294. data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.cpp +216 -0
  295. data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.h +61 -0
  296. data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.cpp +106 -0
  297. data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.h +55 -0
  298. data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.cpp +49 -0
  299. data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.h +42 -0
  300. data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.cpp +58 -0
  301. data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.h +46 -0
  302. data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.cpp +69 -0
  303. data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.h +47 -0
  304. data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.cpp +129 -0
  305. data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.h +62 -0
  306. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.cpp +47 -0
  307. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.h +45 -0
  308. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.cpp +88 -0
  309. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.h +47 -0
  310. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.cpp +88 -0
  311. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.h +49 -0
  312. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp +132 -0
  313. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.h +91 -0
  314. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.cpp +52 -0
  315. data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.h +47 -0
  316. data/ext/zxing/zxing.cc +224 -0
  317. data/lib/zxing.rb +50 -0
  318. data/lib/zxing/.gitignore +2 -0
  319. data/lib/zxing/aztec.rb +5 -0
  320. data/lib/zxing/aztec/aztec_reader.rb +14 -0
  321. data/lib/zxing/bad_image_exception.rb +4 -0
  322. data/lib/zxing/binarizer.rb +8 -0
  323. data/lib/zxing/binary_bitmap.rb +15 -0
  324. data/lib/zxing/checksum_exception.rb +4 -0
  325. data/lib/zxing/common.rb +7 -0
  326. data/lib/zxing/common/bit_matrix.rb +9 -0
  327. data/lib/zxing/common/hybrid_binarizer.rb +17 -0
  328. data/lib/zxing/common/illegal_argument_exception.rb +4 -0
  329. data/lib/zxing/datamatrix.rb +5 -0
  330. data/lib/zxing/datamatrix/data_matrix_reader.rb +14 -0
  331. data/lib/zxing/decodable.rb +11 -0
  332. data/lib/zxing/exception.rb +4 -0
  333. data/lib/zxing/ffi.rb +20 -0
  334. data/lib/zxing/ffi/aztec.rb +6 -0
  335. data/lib/zxing/ffi/aztec/aztec_reader.rb +9 -0
  336. data/lib/zxing/ffi/binarizer.rb +25 -0
  337. data/lib/zxing/ffi/binary_bitmap.rb +15 -0
  338. data/lib/zxing/ffi/common.rb +8 -0
  339. data/lib/zxing/ffi/common/bit_matrix.rb +12 -0
  340. data/lib/zxing/ffi/common/greyscale_luminance_source.rb +30 -0
  341. data/lib/zxing/ffi/common/hybrid_binarizer.rb +10 -0
  342. data/lib/zxing/ffi/datamatrix.rb +6 -0
  343. data/lib/zxing/ffi/datamatrix/data_matrix_reader.rb +9 -0
  344. data/lib/zxing/ffi/library.rb +102 -0
  345. data/lib/zxing/ffi/luminance_source.rb +18 -0
  346. data/lib/zxing/ffi/multi_format_reader.rb +9 -0
  347. data/lib/zxing/ffi/oned.rb +6 -0
  348. data/lib/zxing/ffi/oned/code_39_reader.rb +10 -0
  349. data/lib/zxing/ffi/qrcode.rb +8 -0
  350. data/lib/zxing/ffi/qrcode/decoder.rb +10 -0
  351. data/lib/zxing/ffi/qrcode/detector.rb +10 -0
  352. data/lib/zxing/ffi/reader.rb +58 -0
  353. data/lib/zxing/ffi/result.rb +23 -0
  354. data/lib/zxing/format_exception.rb +4 -0
  355. data/lib/zxing/illegal_argument_exception.rb +4 -0
  356. data/lib/zxing/image.rb +15 -0
  357. data/lib/zxing/luminance_source.rb +18 -0
  358. data/lib/zxing/multi_format_reader.rb +11 -0
  359. data/lib/zxing/not_found_exception.rb +4 -0
  360. data/lib/zxing/oned.rb +5 -0
  361. data/lib/zxing/oned/code_39_reader.rb +15 -0
  362. data/lib/zxing/qrcode.rb +8 -0
  363. data/lib/zxing/qrcode/decoder.rb +14 -0
  364. data/lib/zxing/qrcode/detector.rb +14 -0
  365. data/lib/zxing/qrcode/encoder.rb +8 -0
  366. data/lib/zxing/qrcode/encoder/byte_matrix.rb +18 -0
  367. data/lib/zxing/qrcode/encoder/encoder.rb +9 -0
  368. data/lib/zxing/qrcode/encoder/qrcode.rb +18 -0
  369. data/lib/zxing/reader.rb +8 -0
  370. data/lib/zxing/reader_exception.rb +4 -0
  371. data/lib/zxing/reed_solomon_exception.rb +2 -0
  372. data/lib/zxing/result.rb +18 -0
  373. data/lib/zxing/rmagick.rb +5 -0
  374. data/lib/zxing/rmagick/image.rb +109 -0
  375. data/lib/zxing/version.rb +33 -0
  376. data/zxing_cpp.gemspec +36 -0
  377. metadata +515 -0
@@ -0,0 +1,68 @@
1
+ #ifndef __MODULUS_GFPOLY_PDF_H__
2
+ #define __MODULUS_GFPOLY_PDF_H__
3
+
4
+ /*
5
+ * Copyright 2012 ZXing authors
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * 2012-09-17 HFN translation from Java into C++
20
+ */
21
+
22
+ #include <zxing/common/Counted.h>
23
+ #include <zxing/common/Array.h>
24
+ #include <zxing/common/DecoderResult.h>
25
+ #include <zxing/common/BitMatrix.h>
26
+
27
+ namespace zxing {
28
+ namespace pdf417 {
29
+ namespace decoder {
30
+ namespace ec {
31
+
32
+ class ModulusGF;
33
+
34
+ /**
35
+ * @author Sean Owen
36
+ * @see com.google.zxing.common.reedsolomon.GenericGFPoly
37
+ */
38
+ class ModulusPoly: public Counted {
39
+
40
+ private:
41
+ ModulusGF &field_;
42
+ ArrayRef<int> coefficients_;
43
+ public:
44
+ ModulusPoly(ModulusGF& field, ArrayRef<int> coefficients);
45
+ ~ModulusPoly();
46
+ ArrayRef<int> getCoefficients();
47
+ int getDegree();
48
+ bool isZero();
49
+ int getCoefficient(int degree);
50
+ int evaluateAt(int a);
51
+ Ref<ModulusPoly> add(Ref<ModulusPoly> other);
52
+ Ref<ModulusPoly> subtract(Ref<ModulusPoly> other);
53
+ Ref<ModulusPoly> multiply(Ref<ModulusPoly> other);
54
+ Ref<ModulusPoly> negative();
55
+ Ref<ModulusPoly> multiply(int scalar);
56
+ Ref<ModulusPoly> multiplyByMonomial(int degree, int coefficient);
57
+ std::vector<Ref<ModulusPoly> > divide(Ref<ModulusPoly> other);
58
+ #if 0
59
+ public String toString();
60
+ #endif
61
+ };
62
+
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ #endif /* __MODULUS_GFPOLY_PDF_H__ */
@@ -0,0 +1,665 @@
1
+ // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
2
+ /*
3
+ * Copyright 2010 ZXing authors All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #include <limits>
19
+ #include <zxing/pdf417/detector/Detector.h>
20
+ #include <zxing/pdf417/detector/LinesSampler.h>
21
+ #include <zxing/common/GridSampler.h>
22
+ #include <zxing/common/detector/JavaMath.h>
23
+ #include <zxing/common/detector/MathUtils.h>
24
+ #include <algorithm> // vs12, std::min und std:max
25
+
26
+ using std::max;
27
+ using std::abs;
28
+ using std::numeric_limits;
29
+ using zxing::pdf417::detector::Detector;
30
+ using zxing::common::detector::Math;
31
+ using zxing::common::detector::MathUtils;
32
+ using zxing::Ref;
33
+ using zxing::ArrayRef;
34
+ using zxing::DetectorResult;
35
+ using zxing::ResultPoint;
36
+ using zxing::Point;
37
+ using zxing::BitMatrix;
38
+ using zxing::GridSampler;
39
+
40
+ // VC++
41
+
42
+ using zxing::BinaryBitmap;
43
+ using zxing::DecodeHints;
44
+ using zxing::Line;
45
+
46
+ /**
47
+ * <p>Encapsulates logic that can detect a PDF417 Code in an image, even if the
48
+ * PDF417 Code is rotated or skewed, or partially obscured.</p>
49
+ *
50
+ * @author SITA Lab (kevin.osullivan@sita.aero)
51
+ * @author Daniel Switkin (dswitkin@google.com)
52
+ * @author Schweers Informationstechnologie GmbH (hartmut.neubauer@schweers.de)
53
+ * @author creatale GmbH (christoph.schulz@creatale.de)
54
+ */
55
+
56
+ const int Detector::MAX_AVG_VARIANCE= (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
57
+ const int Detector::MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f);
58
+
59
+ // B S B S B S B S Bar/Space pattern
60
+ // 11111111 0 1 0 1 0 1 000
61
+ const int Detector::START_PATTERN[] = {8, 1, 1, 1, 1, 1, 1, 3};
62
+ const int Detector::START_PATTERN_LENGTH = sizeof(START_PATTERN) / sizeof(int);
63
+
64
+ // 11111111 0 1 0 1 0 1 000
65
+ const int Detector::START_PATTERN_REVERSE[] = {3, 1, 1, 1, 1, 1, 1, 8};
66
+ const int Detector::START_PATTERN_REVERSE_LENGTH = sizeof(START_PATTERN_REVERSE) / sizeof(int);
67
+
68
+ // 1111111 0 1 000 1 0 1 00 1
69
+ const int Detector::STOP_PATTERN[] = {7, 1, 1, 3, 1, 1, 1, 2, 1};
70
+ const int Detector::STOP_PATTERN_LENGTH = sizeof(STOP_PATTERN) / sizeof(int);
71
+
72
+ // B S B S B S B S B Bar/Space pattern
73
+ // 1111111 0 1 000 1 0 1 00 1
74
+ const int Detector::STOP_PATTERN_REVERSE[] = {1, 2, 1, 1, 1, 3, 1, 1, 7};
75
+ const int Detector::STOP_PATTERN_REVERSE_LENGTH = sizeof(STOP_PATTERN_REVERSE) / sizeof(int);
76
+
77
+ Detector::Detector(Ref<BinaryBitmap> image) : image_(image) {}
78
+
79
+ Ref<DetectorResult> Detector::detect() {
80
+ return detect(DecodeHints());
81
+ }
82
+
83
+ Ref<DetectorResult> Detector::detect(DecodeHints const& hints) {
84
+ (void)hints;
85
+ // Fetch the 1 bit matrix once up front.
86
+ Ref<BitMatrix> matrix = image_->getBlackMatrix();
87
+
88
+ // Try to find the vertices assuming the image is upright.
89
+ const int rowStep = 8;
90
+ ArrayRef< Ref<ResultPoint> > vertices (findVertices(matrix, rowStep));
91
+ if (!vertices) {
92
+ // Maybe the image is rotated 180 degrees?
93
+ vertices = findVertices180(matrix, rowStep);
94
+ if (vertices) {
95
+ correctVertices(matrix, vertices, true);
96
+ }
97
+ } else {
98
+ correctVertices(matrix, vertices, false);
99
+ }
100
+
101
+ if (!vertices) {
102
+ throw NotFoundException("No vertices found.");
103
+ }
104
+
105
+ float moduleWidth = computeModuleWidth(vertices);
106
+ if (moduleWidth < 1.0f) {
107
+ throw NotFoundException("Bad module width.");
108
+ }
109
+
110
+ int dimension = computeDimension(vertices[12], vertices[14],
111
+ vertices[13], vertices[15], moduleWidth);
112
+ if (dimension < 1) {
113
+ throw NotFoundException("Bad dimension.");
114
+ }
115
+
116
+ int yDimension = max(computeYDimension(vertices[12], vertices[14],
117
+ vertices[13], vertices[15], moduleWidth), dimension);
118
+
119
+ // Deskew and sample lines from image.
120
+ Ref<BitMatrix> linesMatrix = sampleLines(vertices, dimension, yDimension);
121
+ Ref<BitMatrix> linesGrid(LinesSampler(linesMatrix, dimension).sample());
122
+
123
+ ArrayRef< Ref<ResultPoint> > points(4);
124
+ points[0] = vertices[5];
125
+ points[1] = vertices[4];
126
+ points[2] = vertices[6];
127
+ points[3] = vertices[7];
128
+ return Ref<DetectorResult>(new DetectorResult(linesGrid, points));
129
+ }
130
+
131
+ /**
132
+ * Locate the vertices and the codewords area of a black blob using the Start
133
+ * and Stop patterns as locators.
134
+ *
135
+ * @param matrix the scanned barcode image.
136
+ * @param rowStep the step size for iterating rows (every n-th row).
137
+ * @return an array containing the vertices:
138
+ * vertices[0] x, y top left barcode
139
+ * vertices[1] x, y bottom left barcode
140
+ * vertices[2] x, y top right barcode
141
+ * vertices[3] x, y bottom right barcode
142
+ * vertices[4] x, y top left codeword area
143
+ * vertices[5] x, y bottom left codeword area
144
+ * vertices[6] x, y top right codeword area
145
+ * vertices[7] x, y bottom right codeword area
146
+ */
147
+ ArrayRef< Ref<ResultPoint> > Detector::findVertices(Ref<BitMatrix> matrix, int rowStep)
148
+ {
149
+ const int height = matrix->getHeight();
150
+ const int width = matrix->getWidth();
151
+
152
+ ArrayRef< Ref<ResultPoint> > result(16);
153
+ bool found = false;
154
+
155
+ ArrayRef<int> counters(new Array<int>(START_PATTERN_LENGTH));
156
+
157
+ // Top Left
158
+ for (int i = 0; i < height; i += rowStep) {
159
+ ArrayRef<int> loc = findGuardPattern(matrix, 0, i, width, false, START_PATTERN,
160
+ START_PATTERN_LENGTH, counters);
161
+ if (loc) {
162
+ result[0] = new ResultPoint((float)loc[0], (float)i);
163
+ result[4] = new ResultPoint((float)loc[1], (float)i);
164
+ found = true;
165
+ break;
166
+ }
167
+ }
168
+ // Bottom left
169
+ if (found) { // Found the Top Left vertex
170
+ found = false;
171
+ for (int i = height - 1; i > 0; i -= rowStep) {
172
+ ArrayRef<int> loc = findGuardPattern(matrix, 0, i, width, false, START_PATTERN,
173
+ START_PATTERN_LENGTH, counters);
174
+ if (loc) {
175
+ result[1] = new ResultPoint((float)loc[0], (float)i);
176
+ result[5] = new ResultPoint((float)loc[1], (float)i);
177
+ found = true;
178
+ break;
179
+ }
180
+ }
181
+ }
182
+
183
+ counters = new Array<int>(STOP_PATTERN_LENGTH);
184
+
185
+ // Top right
186
+ if (found) { // Found the Bottom Left vertex
187
+ found = false;
188
+ for (int i = 0; i < height; i += rowStep) {
189
+ ArrayRef<int> loc = findGuardPattern(matrix, 0, i, width, false, STOP_PATTERN,
190
+ STOP_PATTERN_LENGTH, counters);
191
+ if (loc) {
192
+ result[2] = new ResultPoint((float)loc[1], (float)i);
193
+ result[6] = new ResultPoint((float)loc[0], (float)i);
194
+ found = true;
195
+ break;
196
+ }
197
+ }
198
+ }
199
+ // Bottom right
200
+ if (found) { // Found the Top right vertex
201
+ found = false;
202
+ for (int i = height - 1; i > 0; i -= rowStep) {
203
+ ArrayRef<int> loc = findGuardPattern(matrix, 0, i, width, false, STOP_PATTERN,
204
+ STOP_PATTERN_LENGTH, counters);
205
+ if (loc) {
206
+ result[3] = new ResultPoint((float)loc[1], (float)i);
207
+ result[7] = new ResultPoint((float)loc[0], (float)i);
208
+ found = true;
209
+ break;
210
+ }
211
+ }
212
+ }
213
+
214
+ return found ? result : ArrayRef< Ref<ResultPoint> >();
215
+ }
216
+
217
+ ArrayRef< Ref<ResultPoint> > Detector::findVertices180(Ref<BitMatrix> matrix, int rowStep) {
218
+ const int height = matrix->getHeight();
219
+ const int width = matrix->getWidth();
220
+ const int halfWidth = width >> 1;
221
+
222
+ ArrayRef< Ref<ResultPoint> > result(16);
223
+ bool found = false;
224
+
225
+ ArrayRef<int> counters = new Array<int>(START_PATTERN_REVERSE_LENGTH);
226
+
227
+ // Top Left
228
+ for (int i = height - 1; i > 0; i -= rowStep) {
229
+ ArrayRef<int> loc =
230
+ findGuardPattern(matrix, halfWidth, i, halfWidth, true, START_PATTERN_REVERSE,
231
+ START_PATTERN_REVERSE_LENGTH, counters);
232
+ if (loc) {
233
+ result[0] = new ResultPoint((float)loc[1], (float)i);
234
+ result[4] = new ResultPoint((float)loc[0], (float)i);
235
+ found = true;
236
+ break;
237
+ }
238
+ }
239
+ // Bottom Left
240
+ if (found) { // Found the Top Left vertex
241
+ found = false;
242
+ for (int i = 0; i < height; i += rowStep) {
243
+ ArrayRef<int> loc =
244
+ findGuardPattern(matrix, halfWidth, i, halfWidth, true, START_PATTERN_REVERSE,
245
+ START_PATTERN_REVERSE_LENGTH, counters);
246
+ if (loc) {
247
+ result[1] = new ResultPoint((float)loc[1], (float)i);
248
+ result[5] = new ResultPoint((float)loc[0], (float)i);
249
+ found = true;
250
+ break;
251
+ }
252
+ }
253
+ }
254
+
255
+ counters = new Array<int>(STOP_PATTERN_REVERSE_LENGTH);
256
+
257
+ // Top Right
258
+ if (found) { // Found the Bottom Left vertex
259
+ found = false;
260
+ for (int i = height - 1; i > 0; i -= rowStep) {
261
+ ArrayRef<int> loc = findGuardPattern(matrix, 0, i, halfWidth, false, STOP_PATTERN_REVERSE,
262
+ STOP_PATTERN_REVERSE_LENGTH, counters);
263
+ if (loc) {
264
+ result[2] = new ResultPoint((float)loc[0], (float)i);
265
+ result[6] = new ResultPoint((float)loc[1], (float)i);
266
+ found = true;
267
+ break;
268
+ }
269
+ }
270
+ }
271
+ // Bottom Right
272
+ if (found) { // Found the Top Right vertex
273
+ found = false;
274
+ for (int i = 0; i < height; i += rowStep) {
275
+ ArrayRef<int> loc = findGuardPattern(matrix, 0, i, halfWidth, false, STOP_PATTERN_REVERSE,
276
+ STOP_PATTERN_REVERSE_LENGTH, counters);
277
+ if (loc) {
278
+ result[3] = new ResultPoint((float)loc[0], (float)i);
279
+ result[7] = new ResultPoint((float)loc[1], (float)i);
280
+ found = true;
281
+ break;
282
+ }
283
+ }
284
+ }
285
+
286
+ return found ? result : ArrayRef< Ref<ResultPoint> >();
287
+ }
288
+
289
+ /**
290
+ * @param matrix row of black/white values to search
291
+ * @param column x position to start search
292
+ * @param row y position to start search
293
+ * @param width the number of pixels to search on this row
294
+ * @param pattern pattern of counts of number of black and white pixels that are
295
+ * being searched for as a pattern
296
+ * @param counters array of counters, as long as pattern, to re-use
297
+ * @return start/end horizontal offset of guard pattern, as an array of two ints.
298
+ */
299
+ ArrayRef<int> Detector::findGuardPattern(Ref<BitMatrix> matrix,
300
+ int column,
301
+ int row,
302
+ int width,
303
+ bool whiteFirst,
304
+ const int pattern[],
305
+ int patternSize,
306
+ ArrayRef<int>& counters) {
307
+ counters->values().assign(counters->size(), 0);
308
+ int patternLength = patternSize;
309
+ bool isWhite = whiteFirst;
310
+
311
+ int counterPosition = 0;
312
+ int patternStart = column;
313
+ for (int x = column; x < column + width; x++) {
314
+ bool pixel = matrix->get(x, row);
315
+ if (pixel ^ isWhite) {
316
+ counters[counterPosition]++;
317
+ } else {
318
+ if (counterPosition == patternLength - 1) {
319
+ if (patternMatchVariance(counters, pattern,
320
+ MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
321
+ ArrayRef<int> result = new Array<int>(2);
322
+ result[0] = patternStart;
323
+ result[1] = x;
324
+ return result;
325
+ }
326
+ patternStart += counters[0] + counters[1];
327
+ for(int i = 0; i < patternLength - 2; ++i)
328
+ counters[i] = counters[ i + 2];
329
+ counters[patternLength - 2] = 0;
330
+ counters[patternLength - 1] = 0;
331
+ counterPosition--;
332
+ } else {
333
+ counterPosition++;
334
+ }
335
+ counters[counterPosition] = 1;
336
+ isWhite = !isWhite;
337
+ }
338
+ }
339
+ return ArrayRef<int>();
340
+ }
341
+
342
+ /**
343
+ * Determines how closely a set of observed counts of runs of black/white
344
+ * values matches a given target pattern. This is reported as the ratio of
345
+ * the total variance from the expected pattern proportions across all
346
+ * pattern elements, to the length of the pattern.
347
+ *
348
+ * @param counters observed counters
349
+ * @param pattern expected pattern
350
+ * @param maxIndividualVariance The most any counter can differ before we give up
351
+ * @return ratio of total variance between counters and pattern compared to
352
+ * total pattern size, where the ratio has been multiplied by 256.
353
+ * So, 0 means no variance (perfect match); 256 means the total
354
+ * variance between counters and patterns equals the pattern length,
355
+ * higher values mean even more variance
356
+ */
357
+ int Detector::patternMatchVariance(ArrayRef<int>& counters,
358
+ const int pattern[],
359
+ int maxIndividualVariance)
360
+ {
361
+ int numCounters = counters->size();
362
+ int total = 0;
363
+ int patternLength = 0;
364
+ for (int i = 0; i < numCounters; i++) {
365
+ total += counters[i];
366
+ patternLength += pattern[i];
367
+ }
368
+ if (total < patternLength) {
369
+ // If we don't even have one pixel per unit of bar width, assume this
370
+ // is too small to reliably match, so fail:
371
+ return numeric_limits<int>::max();
372
+ }
373
+ // We're going to fake floating-point math in integers. We just need to use more bits.
374
+ // Scale up patternLength so that intermediate values below like scaledCounter will have
375
+ // more "significant digits".
376
+ int unitBarWidth = (total << 8) / patternLength;
377
+ maxIndividualVariance = (maxIndividualVariance * unitBarWidth) >> 8;
378
+
379
+ int totalVariance = 0;
380
+ for (int x = 0; x < numCounters; x++) {
381
+ int counter = counters[x] << 8;
382
+ int scaledPattern = pattern[x] * unitBarWidth;
383
+ int variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
384
+ if (variance > maxIndividualVariance) {
385
+ return numeric_limits<int>::max();
386
+ }
387
+ totalVariance += variance;
388
+ }
389
+ return totalVariance / total;
390
+ }
391
+
392
+ /**
393
+ * <p>Correct the vertices by searching for top and bottom vertices of wide
394
+ * bars, then locate the intersections between the upper and lower horizontal
395
+ * line and the inner vertices vertical lines.</p>
396
+ *
397
+ * @param matrix the scanned barcode image.
398
+ * @param vertices the vertices vector is extended and the new members are:
399
+ * vertices[ 8] x,y point on upper border of left wide bar
400
+ * vertices[ 9] x,y point on lower border of left wide bar
401
+ * vertices[10] x,y point on upper border of right wide bar
402
+ * vertices[11] x,y point on lower border of right wide bar
403
+ * vertices[12] x,y final top left codeword area
404
+ * vertices[13] x,y final bottom left codeword area
405
+ * vertices[14] x,y final top right codeword area
406
+ * vertices[15] x,y final bottom right codeword area
407
+ * @param upsideDown true if rotated by 180 degree.
408
+ */
409
+ void Detector::correctVertices(Ref<BitMatrix> matrix,
410
+ ArrayRef< Ref<ResultPoint> >& vertices,
411
+ bool upsideDown)
412
+ {
413
+ bool isLowLeft = abs(vertices[4]->getY() - vertices[5]->getY()) < 20.0;
414
+ bool isLowRight = abs(vertices[6]->getY() - vertices[7]->getY()) < 20.0;
415
+ if (isLowLeft || isLowRight) {
416
+ throw NotFoundException("Cannot find enough PDF417 guard patterns!");
417
+ } else {
418
+ findWideBarTopBottom(matrix, vertices, 0, 0, 8, 17, upsideDown ? 1 : -1);
419
+ findWideBarTopBottom(matrix, vertices, 1, 0, 8, 17, upsideDown ? -1 : 1);
420
+ findWideBarTopBottom(matrix, vertices, 2, 11, 7, 18, upsideDown ? 1 : -1);
421
+ findWideBarTopBottom(matrix, vertices, 3, 11, 7, 18, upsideDown ? -1 : 1);
422
+ findCrossingPoint(vertices, 12, 4, 5, 8, 10, matrix);
423
+ findCrossingPoint(vertices, 13, 4, 5, 9, 11, matrix);
424
+ findCrossingPoint(vertices, 14, 6, 7, 8, 10, matrix);
425
+ findCrossingPoint(vertices, 15, 6, 7, 9, 11, matrix);
426
+ }
427
+ }
428
+
429
+ /**
430
+ * <p>Locate the top or bottom of one of the two wide black bars of a guard pattern.</p>
431
+ *
432
+ * <p>Warning: it only searches along the y axis, so the return points would not be
433
+ * right if the barcode is too curved.</p>
434
+ *
435
+ * @param matrix The bit matrix.
436
+ * @param vertices The 16 vertices located by findVertices(); the result
437
+ * points are stored into vertices[8], ... , vertices[11].
438
+ * @param offsetVertice The offset of the outer vertice and the inner
439
+ * vertice (+ 4) to be corrected and (+ 8) where the result is stored.
440
+ * @param startWideBar start of a wide bar.
441
+ * @param lenWideBar length of wide bar.
442
+ * @param lenPattern length of the pattern.
443
+ * @param rowStep +1 if corner should be exceeded towards the bottom, -1 towards the top.
444
+ */
445
+ void Detector::findWideBarTopBottom(Ref<BitMatrix> matrix,
446
+ ArrayRef< Ref<ResultPoint> > &vertices,
447
+ int offsetVertice,
448
+ int startWideBar,
449
+ int lenWideBar,
450
+ int lenPattern,
451
+ int rowStep)
452
+ {
453
+ Ref<ResultPoint> verticeStart(vertices[offsetVertice]);
454
+ Ref<ResultPoint> verticeEnd(vertices[offsetVertice + 4]);
455
+
456
+ // Start horizontally at the middle of the bar.
457
+ int endWideBar = startWideBar + lenWideBar;
458
+ float barDiff = verticeEnd->getX() - verticeStart->getX();
459
+ float barStart = verticeStart->getX() + barDiff * (float)startWideBar / (float)lenPattern;
460
+ float barEnd = verticeStart->getX() + barDiff * (float)endWideBar / (float)lenPattern;
461
+ int x = Math::round((barStart + barEnd) / 2.0f);
462
+
463
+ // Start vertically between the preliminary vertices.
464
+ int yStart = Math::round(verticeStart->getY());
465
+ int y = yStart;
466
+
467
+ // Find offset of thin bar to the right as additional safeguard.
468
+ int nextBarX = int(max(barStart, barEnd) + 1);
469
+ for (; nextBarX < matrix->getWidth(); nextBarX++)
470
+ if (!matrix->get(nextBarX - 1, y) && matrix->get(nextBarX, y)) break;
471
+ nextBarX -= x;
472
+
473
+ bool isEnd = false;
474
+ while (!isEnd) {
475
+ if (matrix->get(x, y)) {
476
+ // If the thin bar to the right ended, stop as well
477
+ isEnd = !matrix->get(x + nextBarX, y) && !matrix->get(x + nextBarX + 1, y);
478
+ y += rowStep;
479
+ if (y <= 0 || y >= (int)matrix->getHeight() - 1) {
480
+ // End of barcode image reached.
481
+ isEnd = true;
482
+ }
483
+ } else {
484
+ // Look sidewise whether black bar continues? (in the case the image is skewed)
485
+ if (x > 0 && matrix->get(x - 1, y)) {
486
+ x--;
487
+ } else if (x < (int)matrix->getWidth() - 1 && matrix->get(x + 1, y)) {
488
+ x++;
489
+ } else {
490
+ // End of pattern regarding big bar and big gap reached.
491
+ isEnd = true;
492
+ if (y != yStart) {
493
+ // Turn back one step, because target has been exceeded.
494
+ y -= rowStep;
495
+ }
496
+ }
497
+ }
498
+ }
499
+
500
+ vertices[offsetVertice + 8] = new ResultPoint((float)x, (float)y);
501
+ }
502
+
503
+ /**
504
+ * <p>Finds the intersection of two lines.</p>
505
+ *
506
+ * @param vertices The reference of the vertices vector
507
+ * @param idxResult Index of result point inside the vertices vector.
508
+ * @param idxLineA1
509
+ * @param idxLineA2 Indices two points inside the vertices vector that define the first line.
510
+ * @param idxLineB1
511
+ * @param idxLineB2 Indices two points inside the vertices vector that define the second line.
512
+ * @param matrix: bit matrix, here only for testing whether the result is inside the matrix.
513
+ * @return Returns true when the result is valid and lies inside the matrix. Otherwise throws an
514
+ * exception.
515
+ **/
516
+ void Detector::findCrossingPoint(ArrayRef< Ref<ResultPoint> >& vertices,
517
+ int idxResult,
518
+ int idxLineA1, int idxLineA2,
519
+ int idxLineB1, int idxLineB2,
520
+ Ref<BitMatrix>& matrix)
521
+ {
522
+ Point p1(vertices[idxLineA1]->getX(), vertices[idxLineA1]->getY());
523
+ Point p2(vertices[idxLineA2]->getX(), vertices[idxLineA2]->getY());
524
+ Point p3(vertices[idxLineB1]->getX(), vertices[idxLineB1]->getY());
525
+ Point p4(vertices[idxLineB2]->getX(), vertices[idxLineB2]->getY());
526
+
527
+ Point result(intersection(Line(p1, p2), Line(p3, p4)));
528
+ if (result.x == numeric_limits<float>::infinity() ||
529
+ result.y == numeric_limits<float>::infinity()) {
530
+ throw NotFoundException("PDF:Detector: cannot find the crossing of parallel lines!");
531
+ }
532
+
533
+ int x = Math::round(result.x);
534
+ int y = Math::round(result.y);
535
+ if (x < 0 || x >= (int)matrix->getWidth() || y < 0 || y >= (int)matrix->getHeight()) {
536
+ throw NotFoundException("PDF:Detector: crossing points out of region!");
537
+ }
538
+
539
+ vertices[idxResult] = Ref<ResultPoint>(new ResultPoint(result.x, result.y));
540
+ }
541
+
542
+ /**
543
+ * Computes the intersection between two lines.
544
+ */
545
+ Point Detector::intersection(Line a, Line b) {
546
+ float dxa = a.start.x - a.end.x;
547
+ float dxb = b.start.x - b.end.x;
548
+ float dya = a.start.y - a.end.y;
549
+ float dyb = b.start.y - b.end.y;
550
+
551
+ float p = a.start.x * a.end.y - a.start.y * a.end.x;
552
+ float q = b.start.x * b.end.y - b.start.y * b.end.x;
553
+ float denom = dxa * dyb - dya * dxb;
554
+ if(abs(denom) < 1e-12) // Lines don't intersect (replaces "denom == 0")
555
+ return Point(numeric_limits<float>::infinity(),
556
+ numeric_limits<float>::infinity());
557
+
558
+ float x = (p * dxb - dxa * q) / denom;
559
+ float y = (p * dyb - dya * q) / denom;
560
+
561
+ return Point(x, y);
562
+ }
563
+
564
+ /**
565
+ * <p>Estimates module size (pixels in a module) based on the Start and End
566
+ * finder patterns.</p>
567
+ *
568
+ * @param vertices an array of vertices:
569
+ * vertices[0] x, y top left barcode
570
+ * vertices[1] x, y bottom left barcode
571
+ * vertices[2] x, y top right barcode
572
+ * vertices[3] x, y bottom right barcode
573
+ * vertices[4] x, y top left codeword area
574
+ * vertices[5] x, y bottom left codeword area
575
+ * vertices[6] x, y top right codeword area
576
+ * vertices[7] x, y bottom right codeword area
577
+ * @return the module size.
578
+ */
579
+ float Detector::computeModuleWidth(ArrayRef< Ref<ResultPoint> >& vertices) {
580
+ float pixels1 = ResultPoint::distance(vertices[0], vertices[4]);
581
+ float pixels2 = ResultPoint::distance(vertices[1], vertices[5]);
582
+ float moduleWidth1 = (pixels1 + pixels2) / (17 * 2.0f);
583
+ float pixels3 = ResultPoint::distance(vertices[6], vertices[2]);
584
+ float pixels4 = ResultPoint::distance(vertices[7], vertices[3]);
585
+ float moduleWidth2 = (pixels3 + pixels4) / (18 * 2.0f);
586
+ return (moduleWidth1 + moduleWidth2) / 2.0f;
587
+ }
588
+
589
+ /**
590
+ * Computes the dimension (number of modules in a row) of the PDF417 Code
591
+ * based on vertices of the codeword area and estimated module size.
592
+ *
593
+ * @param topLeft of codeword area
594
+ * @param topRight of codeword area
595
+ * @param bottomLeft of codeword area
596
+ * @param bottomRight of codeword are
597
+ * @param moduleWidth estimated module size
598
+ * @return the number of modules in a row.
599
+ */
600
+ int Detector::computeDimension(Ref<ResultPoint> const& topLeft,
601
+ Ref<ResultPoint> const& topRight,
602
+ Ref<ResultPoint> const& bottomLeft,
603
+ Ref<ResultPoint> const& bottomRight,
604
+ float moduleWidth)
605
+ {
606
+ int topRowDimension = MathUtils::round(ResultPoint::distance(topLeft, topRight) / moduleWidth);
607
+ int bottomRowDimension =
608
+ MathUtils::round(ResultPoint::distance(bottomLeft, bottomRight) / moduleWidth);
609
+ return ((((topRowDimension + bottomRowDimension) >> 1) + 8) / 17) * 17;
610
+ }
611
+
612
+ /**
613
+ * Computes the y dimension (number of modules in a column) of the PDF417 Code
614
+ * based on vertices of the codeword area and estimated module size.
615
+ *
616
+ * @param topLeft of codeword area
617
+ * @param topRight of codeword area
618
+ * @param bottomLeft of codeword area
619
+ * @param bottomRight of codeword are
620
+ * @param moduleWidth estimated module size
621
+ * @return the number of modules in a row.
622
+ */
623
+ int Detector::computeYDimension(Ref<ResultPoint> const& topLeft,
624
+ Ref<ResultPoint> const& topRight,
625
+ Ref<ResultPoint> const& bottomLeft,
626
+ Ref<ResultPoint> const& bottomRight,
627
+ float moduleWidth)
628
+ {
629
+ int leftColumnDimension =
630
+ MathUtils::round(ResultPoint::distance(topLeft, bottomLeft) / moduleWidth);
631
+ int rightColumnDimension =
632
+ MathUtils::round(ResultPoint::distance(topRight, bottomRight) / moduleWidth);
633
+ return (leftColumnDimension + rightColumnDimension) >> 1;
634
+ }
635
+
636
+ /**
637
+ * Deskew and over-sample image.
638
+ *
639
+ * @param vertices vertices from findVertices()
640
+ * @param dimension x dimension
641
+ * @param yDimension y dimension
642
+ * @return an over-sampled BitMatrix.
643
+ */
644
+ Ref<BitMatrix> Detector::sampleLines(ArrayRef< Ref<ResultPoint> > const& vertices,
645
+ int dimensionY,
646
+ int dimension) {
647
+ const int sampleDimensionX = dimension * 8;
648
+ const int sampleDimensionY = dimensionY * 4;
649
+ Ref<PerspectiveTransform> transform(
650
+ PerspectiveTransform::quadrilateralToQuadrilateral(
651
+ 0.0f, 0.0f,
652
+ (float)sampleDimensionX, 0.0f,
653
+ 0.0f, (float)sampleDimensionY,
654
+ (float)sampleDimensionX, (float)sampleDimensionY,
655
+ vertices[12]->getX(), vertices[12]->getY(),
656
+ vertices[14]->getX(), vertices[14]->getY(),
657
+ vertices[13]->getX(), vertices[13]->getY(),
658
+ vertices[15]->getX(), vertices[15]->getY()));
659
+
660
+ Ref<BitMatrix> linesMatrix = GridSampler::getInstance().sampleGrid(
661
+ image_->getBlackMatrix(), sampleDimensionX, sampleDimensionY, transform);
662
+
663
+
664
+ return linesMatrix;
665
+ }