├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ └── clang-format-check.yml ├── include └── daisykit │ ├── processors │ ├── trackers │ │ └── .gitkeep │ ├── signal_processors │ │ ├── z_score_filter.h │ │ └── signal_smoothing.h │ ├── image_processors │ │ └── img_utils.h │ └── fitness │ │ └── pushup_analyzer.h │ ├── common │ ├── types │ │ ├── keypoint.h │ │ ├── action.h │ │ ├── keypoint_xyz.h │ │ ├── box.h │ │ ├── feature_set.h │ │ ├── face_search_result.h │ │ ├── object.h │ │ ├── object_with_keypoints_xyz.h │ │ ├── object_with_keypoints.h │ │ ├── face_extended.h │ │ └── face.h │ ├── types.h │ ├── utils │ │ └── timer.h │ ├── io │ │ └── android_assets_stream.h │ └── profiler.h │ ├── graphs │ ├── core │ │ ├── node_type.h │ │ ├── transmission_profile.h │ │ └── graph.h │ └── nodes │ │ └── packet_distributor_node.h │ ├── README.md │ ├── flows │ ├── barcode_scanner_flow.h │ ├── object_detector_flow.h │ ├── background_matting_flow.h │ └── human_pose_movenet_flow.h │ └── models │ ├── face_recognition │ └── face_alignment.h │ └── image_model.h ├── python ├── daisykit │ ├── __init__.py │ └── utils │ │ ├── __init__.py │ │ └── generate_file_list.py └── examples │ ├── barcode_scanner.py │ ├── background_matting.py │ ├── hand_pose_detection.py │ └── human_pose_detection.py ├── docs └── index.md ├── third_party └── zxing-cpp │ ├── README.md │ ├── src │ ├── ZXTestSupport.h │ ├── DecodeStatus.cpp │ ├── DecodeHints.cpp │ ├── StructuredAppend.h │ ├── CustomData.h │ ├── pdf417 │ │ ├── PDFCompaction.h │ │ ├── PDFDecodedBitStreamParser.h │ │ ├── PDFHighLevelEncoder.h │ │ ├── PDFScanningDecoder.h │ │ ├── PDFBarcodeValue.h │ │ ├── PDFReader.h │ │ ├── PDFDetector.h │ │ ├── PDFCodewordDecoder.h │ │ ├── PDFBarcodeMetadata.h │ │ └── PDFBarcodeValue.cpp │ ├── datamatrix │ │ ├── DMSymbolShape.h │ │ ├── DMBitLayout.h │ │ ├── DMDetector.h │ │ ├── DMHighLevelEncoder.h │ │ ├── DMECEncoder.h │ │ ├── DMReader.h │ │ ├── DMDecoder.h │ │ └── DMWriter.h │ ├── qrcode │ │ ├── QRMaskUtil.h │ │ ├── QRDecoder.h │ │ ├── QREncoder.h │ │ ├── QRMatrixUtil.h │ │ ├── QRDecoderMetadata.h │ │ ├── QRReader.h │ │ ├── QRDetector.h │ │ ├── QRErrorCorrectionLevel.h │ │ ├── QREncodeResult.h │ │ ├── QRCodecMode.cpp │ │ ├── QRWriter.cpp │ │ ├── QRDataMask.h │ │ └── QRBitMatrixParser.h │ ├── oned │ │ ├── ODCode128Patterns.h │ │ ├── rss │ │ │ ├── ODRSSExpandedBinaryDecoder.h │ │ │ ├── ODRSSFieldParser.h │ │ │ └── ODRSSGenericAppIdDecoder.h │ │ ├── ODCode93Reader.h │ │ ├── ODCode93Writer.h │ │ ├── ODCode128Reader.h │ │ ├── ODUPCEWriter.h │ │ ├── ODEAN8Writer.h │ │ ├── ODITFWriter.h │ │ ├── ODCodabarWriter.h │ │ ├── ODEAN13Writer.h │ │ ├── ODUPCAWriter.h │ │ ├── ODCodabarReader.h │ │ ├── ODCode39Writer.h │ │ ├── ODCode128Writer.h │ │ ├── ODDataBarReader.h │ │ ├── ODDataBarExpandedReader.h │ │ ├── ODUPCAWriter.cpp │ │ ├── ODRowReader.cpp │ │ ├── ODReader.h │ │ ├── ODMultiUPCEANReader.h │ │ └── ODCode39Reader.h │ ├── ResultPoint.cpp │ ├── TextEncoder.h │ ├── ByteArray.h │ ├── maxicode │ │ ├── MCReader.h │ │ ├── MCBitMatrixParser.h │ │ └── MCDecoder.h │ ├── BitMatrixIO.h │ ├── TritMatrix.h │ ├── BinaryBitmap.cpp │ ├── aztec │ │ ├── AZDecoder.h │ │ ├── AZReader.h │ │ ├── AZToken.h │ │ ├── AZWriter.cpp │ │ ├── AZHighLevelEncoder.h │ │ ├── AZEncoder.h │ │ ├── AZDetector.h │ │ ├── AZWriter.h │ │ ├── AZEncodingState.h │ │ ├── AZToken.cpp │ │ └── AZDetectorResult.h │ ├── CharacterSet.h │ ├── DecodeStatus.h │ ├── ReadBarcode.h │ ├── ByteMatrix.h │ ├── Scope.h │ ├── ResultPoint.h │ ├── ReedSolomonEncoder.h │ ├── TextUtfEncoding.h │ ├── GlobalHistogramBinarizer.h │ ├── TextDecoder.h │ └── MultiFormatReader.h │ ├── ZXingConfig.cmake.in │ └── ZXVersion.h.in ├── pyproject.toml ├── .gitignore ├── .readthedocs.yaml ├── toolchains ├── pi3.toolchain.cmake ├── host.gcc-c++03.toolchain.cmake ├── host.gcc-m32.toolchain.cmake ├── host.clang-m32.toolchain.cmake ├── host.gcc.toolchain.cmake ├── aarch64-linux-gnu.toolchain.cmake ├── mips-mti-linux-gnu.toolchain.cmake ├── powerpc64le-linux-gnu.toolchain.cmake ├── jetson.toolchain.cmake ├── arm-linux-gnueabihf.toolchain.cmake ├── arm-linux-gnueabi.toolchain.cmake ├── aarch64-linux-gnu-c.toolchain.cmake ├── arm-linux-gnueabi-c.toolchain.cmake ├── host-c.gcc.toolchain.cmake ├── host-c.clang.toolchain.cmake ├── iosxc-arm64.toolchain.cmake ├── iosxc.toolchain.cmake ├── iossimxc-x64.toolchain.cmake └── iossimxc.toolchain.cmake ├── scripts └── format_code.sh ├── .clang-format ├── MANIFEST.in ├── conftest.py ├── .vscode └── c_cpp_properties.json ├── .gitmodules ├── .pre-commit-config.yaml └── src ├── graphs └── core │ ├── transmission_profile.cpp │ ├── packet.cpp │ └── graph.cpp ├── common ├── utils │ └── timer.cpp └── profiler.cpp ├── processors ├── signal_processors │ └── signal_smoothing.cpp └── image_processors │ └── img_utils.cpp ├── models └── image_model.cpp └── examples ├── demo_face_detector_scrfd.cpp └── demo_face_detector.cpp /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: vietanhdev 2 | -------------------------------------------------------------------------------- /include/daisykit/processors/trackers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/daisykit/__init__.py: -------------------------------------------------------------------------------- 1 | from .daisykit import * 2 | 3 | __version__ = daisykit.__version__ 4 | -------------------------------------------------------------------------------- /python/daisykit/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .download import * 2 | from .asset_store import * 3 | from .conversion import * 4 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Documentation of Daisykit 2 | 3 | Documentation was moved to [https://github.com/nrl-ai/daisykit-docs](https://github.com/nrl-ai/daisykit-docs). -------------------------------------------------------------------------------- /third_party/zxing-cpp/README.md: -------------------------------------------------------------------------------- 1 | # ZXing-C++ 2 | 3 | This is a part of source code from [nu-book/zxing-cpp](https://github.com/nu-book/zxing-cpp) to read multi-format 1D/2D barcode. -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools", "wheel", "scikit-build", "cmake", "pip", "ninja; sys_platform != 'win32'", "numpy" 4 | ] 5 | build-backend = "setuptools.build_meta" 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /dist 3 | /python/setup.py 4 | /python/*.egg-info 5 | /.idea 6 | /docs/_build 7 | __pycache__ 8 | *.pyc 9 | *.so 10 | /.vscode/settings.json 11 | /third_party/ncnn-* 12 | .DS_Store 13 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | formats: all 4 | 5 | python: 6 | version: 3.7 7 | install: 8 | - requirements: docs/requirements-docs.txt 9 | - requirements: docs/requirements-readthedocs.txt 10 | -------------------------------------------------------------------------------- /toolchains/pi3.toolchain.cmake: -------------------------------------------------------------------------------- 1 | SET(CMAKE_SYSTEM_NANE Android) 2 | SET(CMAKE_SYSTEM_PROCESSOR "armv7l") 3 | SET(ANDROID_ARCH_NAME "arm") 4 | SET(UNIX true) 5 | SET(CMAKE_C_COMPILER "gcc") 6 | SET(CMAKE_CXX_COMPILER "g++") 7 | -------------------------------------------------------------------------------- /scripts/format_code.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | find src include python -type f -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' | grep -v python/pybind11 | grep -v python/pybind11_opencv_numpy | xargs clang-format -i 4 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ZXTestSupport.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef ZXING_BUILD_FOR_TEST 4 | #define ZXING_EXPORT_TEST_ONLY 5 | #define ZXING_IF_NOT_TEST(x) 6 | #else 7 | #define ZXING_EXPORT_TEST_ONLY static 8 | #define ZXING_IF_NOT_TEST(x) x 9 | #endif 10 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | # Use the Google style in this project. 2 | BasedOnStyle: Google 3 | 4 | # Some folks prefer to write "int& foo" while others prefer "int& foo". The 5 | # Google Style Guide only asks for consistency within a project, we chose 6 | # "int& foo" for this project: 7 | DerivePointerAlignment: false 8 | PointerAlignment: Left 9 | 10 | IncludeBlocks: Preserve 11 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | include docs/pipy-doc.md 3 | recursive-include include * 4 | recursive-include src * 5 | recursive-include third_party * 6 | recursive-include python/daisykit * 7 | recursive-include python/examples * 8 | recursive-include python/pybind11 * 9 | recursive-include python/pybind11_opencv_numpy * 10 | recursive-include python/src * 11 | recursive-include python *.txt *.py *.md *.i 12 | -------------------------------------------------------------------------------- /conftest.py: -------------------------------------------------------------------------------- 1 | # Even if empty this file is useful so that when running from the root folder 2 | # ./daisykit is added to sys.path by pytest. See 3 | # https://docs.pytest.org/en/latest/explanation/pythonpath.html for more 4 | # details. For example, this allows to build extensions in place and run pytest 5 | # doc/modules/clustering.rst and use daisykit from the local folder rather than 6 | # the one from site-packages. 7 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/ZXingConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | include("${CMAKE_CURRENT_LIST_DIR}/ZXingTargets.cmake") 3 | 4 | # this does not work: add_library(ZXing::Core ALIAS ZXing::ZXing) 5 | # this is a workaround available since 3.11 : 6 | if(NOT(CMAKE_VERSION VERSION_LESS 3.11)) 7 | add_library(ZXing::Core INTERFACE IMPORTED) 8 | target_link_libraries(ZXing::Core INTERFACE ZXing::ZXing) 9 | endif() 10 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/**" 7 | ], 8 | "defines": [], 9 | "compilerPath": "/usr/bin/clang", 10 | "cStandard": "c17", 11 | "cppStandard": "c++14", 12 | "intelliSenseMode": "linux-clang-x64" 13 | } 14 | ], 15 | "version": 4 16 | } -------------------------------------------------------------------------------- /python/daisykit/utils/generate_file_list.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import glob 4 | from download import calc_sha1 5 | 6 | file_directory = sys.argv[1] 7 | file_directory = os.path.abspath(file_directory) 8 | paths_to_hash = [] 9 | 10 | file_list = [] 11 | for filename in glob.iglob(file_directory + '**/**', recursive=True): 12 | if os.path.isfile(filename): 13 | file_list.append((calc_sha1(filename).hexdigest(), filename)) 14 | 15 | print(file_list) 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "python/pybind11"] 2 | path = python/pybind11 3 | url = https://github.com/pybind/pybind11.git 4 | [submodule "python/pybind11_opencv_numpy"] 5 | path = python/pybind11_opencv_numpy 6 | url = https://github.com/edmBernard/pybind11_opencv_numpy.git 7 | [submodule "third_party/ncnn"] 8 | path = third_party/ncnn 9 | url = https://github.com/Tencent/ncnn.git 10 | [submodule "assets"] 11 | path = assets 12 | url = https://github.com/nrl-ai/daisykit-assets.git 13 | -------------------------------------------------------------------------------- /toolchains/host.gcc-c++03.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR x86) 3 | 4 | set(CMAKE_C_COMPILER "gcc") 5 | set(CMAKE_CXX_COMPILER "g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-ansi") 12 | set(CMAKE_CXX_FLAGS "-std=c++03") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /toolchains/host.gcc-m32.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR x86) 3 | 4 | set(CMAKE_C_COMPILER "gcc") 5 | set(CMAKE_CXX_COMPILER "g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-m32 -msse2 -msse") 12 | set(CMAKE_CXX_FLAGS "-m32 -msse2 -msse") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /toolchains/host.clang-m32.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR x86) 3 | 4 | set(CMAKE_C_COMPILER "clang") 5 | set(CMAKE_CXX_COMPILER "clang++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-m32 -msse2 -msse") 12 | set(CMAKE_CXX_FLAGS "-m32 -msse2 -msse") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /toolchains/host.gcc.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized. 2 | SET ( CMAKE_SYSTEM_NAME Linux ) 3 | SET ( CMAKE_SYSTEM_PROCESSOR x86 ) 4 | # if gcc/g++ was installed: 5 | SET ( CMAKE_C_COMPILER "gcc" ) 6 | SET ( CMAKE_CXX_COMPILER "g++" ) 7 | 8 | # set searching rules 9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) 10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) 11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) 12 | 13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag 14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" ) 15 | -------------------------------------------------------------------------------- /toolchains/aarch64-linux-gnu.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | 4 | set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc") 5 | set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv8-a") 12 | set(CMAKE_CXX_FLAGS "-march=armv8-a") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /toolchains/mips-mti-linux-gnu.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR mips) 3 | 4 | set(CMAKE_C_COMPILER "mips-mti-linux-gnu-gcc") 5 | set(CMAKE_CXX_COMPILER "mips-mti-linux-gnu-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=mips32r6") 12 | set(CMAKE_CXX_FLAGS "-march=mips32r6") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /toolchains/powerpc64le-linux-gnu.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR powerpc64le) 3 | 4 | set(CMAKE_C_COMPILER "powerpc64le-linux-gnu-gcc") 5 | set(CMAKE_CXX_COMPILER "powerpc64le-linux-gnu-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-mcpu=powerpc64le") 12 | set(CMAKE_CXX_FLAGS "-mcpu=powerpc64le") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v2.1.0 4 | hooks: 5 | - id: check-byte-order-marker 6 | - id: check-case-conflict 7 | - id: check-merge-conflict 8 | - id: check-symlinks 9 | - id: check-yaml 10 | - id: end-of-file-fixer 11 | - id: mixed-line-ending 12 | - id: trailing-whitespace 13 | - repo: https://github.com/pre-commit/pre-commit 14 | rev: v1.14.2 15 | hooks: 16 | - id: validate_manifest 17 | - repo: https://github.com/pre-commit/mirrors-clang-format 18 | rev: v14.0.6 19 | hooks: 20 | - id: clang-format 21 | -------------------------------------------------------------------------------- /toolchains/jetson.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | 4 | set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc") 5 | set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++") 6 | 7 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process 8 | # -march=armv8-a could work on Jetson, but will compile without some extra cpu features 9 | set(CMAKE_C_FLAGS "-march=native ${CMAKE_C_FLAGS}") 10 | set(CMAKE_CXX_FLAGS "-march=native ${CMAKE_CXX_FLAGS}") 11 | 12 | # cache flags 13 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 15 | -------------------------------------------------------------------------------- /toolchains/arm-linux-gnueabihf.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | 4 | set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc") 5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon") 12 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /toolchains/arm-linux-gnueabi.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | 4 | set(CMAKE_C_COMPILER "arm-linux-gnueabi-gcc") 5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4") 12 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /toolchains/aarch64-linux-gnu-c.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | 4 | set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc") 5 | set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv8-a") 12 | set(CMAKE_CXX_FLAGS "-march=armv8-a") 13 | 14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nodefaultlibs -fno-builtin -fno-stack-protector -nostdinc++ -lc") 15 | 16 | # cache flags 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 19 | -------------------------------------------------------------------------------- /.github/workflows/clang-format-check.yml: -------------------------------------------------------------------------------- 1 | name: clang-format Check 2 | on: [push, pull_request] 3 | jobs: 4 | formatting-check: 5 | name: Formatting Check 6 | runs-on: ubuntu-latest 7 | strategy: 8 | matrix: 9 | path: 10 | - check: 'src' 11 | exclude: 'third_party' 12 | - check: 'include' 13 | exclude: 'third_party' 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Run clang-format style check for C/C++ programs. 17 | uses: jidicula/clang-format-action@v4.11.0 18 | with: 19 | clang-format-version: '13' 20 | check-path: ${{ matrix.path['check'] }} 21 | exclude-regex: ${{ matrix.path['exclude'] }} 22 | fallback-style: 'Google' # optional 23 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/DecodeStatus.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Nu-book Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "DecodeStatus.h" 18 | 19 | namespace ZXing { 20 | 21 | 22 | } // ZXing 23 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/DecodeHints.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Nu-book Inc. 3 | * Copyright 2016 ZXing authors 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 "DecodeHints.h" 19 | 20 | namespace ZXing { 21 | 22 | } // ZXing 23 | -------------------------------------------------------------------------------- /toolchains/arm-linux-gnueabi-c.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | 4 | set(CMAKE_C_COMPILER "arm-linux-gnueabi-gcc") 5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4") 12 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4") 13 | 14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nodefaultlibs -fno-builtin -fno-stack-protector -nostdinc++ -lc") 15 | 16 | # cache flags 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 19 | -------------------------------------------------------------------------------- /toolchains/host-c.gcc.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized. 2 | SET ( CMAKE_SYSTEM_NAME Linux ) 3 | SET ( CMAKE_SYSTEM_PROCESSOR x86 ) 4 | # if gcc/g++ was installed: 5 | SET ( CMAKE_C_COMPILER "gcc" ) 6 | SET ( CMAKE_CXX_COMPILER "g++" ) 7 | 8 | # set searching rules 9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) 10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) 11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) 12 | 13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag 14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" ) 15 | 16 | set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nodefaultlibs -fno-builtin -nostdinc++ -lc" ) 17 | 18 | # cache flags 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 21 | -------------------------------------------------------------------------------- /toolchains/host-c.clang.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized. 2 | SET ( CMAKE_SYSTEM_NAME Linux ) 3 | SET ( CMAKE_SYSTEM_PROCESSOR x86 ) 4 | # if gcc/g++ was installed: 5 | SET ( CMAKE_C_COMPILER "clang" ) 6 | SET ( CMAKE_CXX_COMPILER "clang++" ) 7 | 8 | # set searching rules 9 | SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) 10 | SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) 11 | SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) 12 | 13 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag 14 | SET ( CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" ) 15 | 16 | set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nodefaultlibs -fno-builtin -nostdinc++ -lc" ) 17 | 18 | # cache flags 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 21 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/ZXVersion.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2019 Nu-book Inc. 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 | // Version numbering 19 | #define ZXING_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ 20 | #define ZXING_VERSION_MINOR @PROJECT_VERSION_MINOR@ 21 | #define ZXING_VERSION_PATCH @PROJECT_VERSION_PATCH@ 22 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/StructuredAppend.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2021 Axel Waggershauser 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 19 | 20 | namespace ZXing { 21 | 22 | struct StructuredAppendInfo 23 | { 24 | int index = -1; 25 | int count = -1; 26 | std::string id; 27 | }; 28 | 29 | } // ZXing 30 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/CustomData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | 21 | class CustomData 22 | { 23 | public: 24 | virtual ~CustomData() = default; 25 | 26 | protected: 27 | CustomData() = default; 28 | }; 29 | 30 | } // ZXing 31 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFCompaction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | namespace Pdf417 { 21 | 22 | enum class Compaction { 23 | AUTO, 24 | TEXT, 25 | BYTE, 26 | NUMERIC 27 | }; 28 | 29 | } // Pdf417 30 | } // ZXing 31 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMSymbolShape.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | namespace DataMatrix { 21 | 22 | enum class SymbolShape { 23 | NONE, 24 | SQUARE, 25 | RECTANGLE, 26 | }; 27 | 28 | } // DataMatrix 29 | } // ZXing 30 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRMaskUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "TritMatrix.h" 20 | 21 | namespace ZXing { 22 | namespace QRCode { 23 | namespace MaskUtil { 24 | int CalculateMaskPenalty(const TritMatrix& matrix); 25 | } 26 | } // QRCode 27 | } // ZXing 28 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode128Patterns.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | namespace OneD { 23 | namespace Code128 { 24 | 25 | extern const std::array, 107> CODE_PATTERNS; 26 | 27 | } // Code128 28 | } // OneD 29 | } // ZXing 30 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/rss/ODRSSExpandedBinaryDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitArray; 24 | 25 | namespace OneD::DataBar { 26 | 27 | std::string DecodeExpandedBits(const BitArray& bits); 28 | 29 | } // namespace OneD::DataBar 30 | } // namespace ZXing 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMBitLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2020 Axel Waggershauser 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 | namespace ZXing { 19 | 20 | class BitMatrix; 21 | class ByteArray; 22 | 23 | namespace DataMatrix { 24 | 25 | BitMatrix BitMatrixFromCodewords(const ByteArray& codewords, int width, int height); 26 | ByteArray CodewordsFromBitMatrix(const BitMatrix& bits); 27 | 28 | } // namespace DataMatrix 29 | } // namespace ZXing 30 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/rss/ODRSSFieldParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | enum class DecodeStatus; 24 | 25 | namespace OneD::DataBar { 26 | 27 | DecodeStatus ParseFieldsInGeneralPurpose(const std::string &rawInfo, std::string& result); 28 | 29 | } // namespace OneD::DataBar 30 | } // namespace ZXing 31 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ResultPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Nu-book Inc. 3 | * Copyright 2016 ZXing authors 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 "ResultPoint.h" 19 | 20 | #include 21 | 22 | namespace ZXing { 23 | 24 | float ResultPoint::Distance(int aX, int aY, int bX, int bY) 25 | { 26 | auto dx = static_cast(aX - bX); 27 | auto dy = static_cast(aY - bY); 28 | return std::sqrt(dx * dx + dy * dy); 29 | } 30 | 31 | } // ZXing 32 | -------------------------------------------------------------------------------- /include/daisykit/common/types/keypoint.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_KEYPOINT_H_ 16 | #define DAISYKIT_COMMON_TYPES_KEYPOINT_H_ 17 | 18 | namespace daisykit { 19 | namespace types { 20 | 21 | struct Keypoint { 22 | float x; 23 | float y; 24 | float confidence; /// Prediction probability 25 | }; 26 | 27 | } // namespace types 28 | } // namespace daisykit 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /python/examples/barcode_scanner.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import json 3 | from daisykit.utils import get_asset_file 4 | from daisykit import BarcodeScannerFlow 5 | 6 | config = { 7 | "try_harder": True, 8 | "try_rotate": True 9 | } 10 | 11 | barcode_scanner_flow = BarcodeScannerFlow(json.dumps(config)) 12 | 13 | # Open video stream from webcam 14 | vid = cv2.VideoCapture(0) 15 | 16 | while(True): 17 | 18 | # Capture the video frame 19 | ret, frame = vid.read() 20 | 21 | frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) 22 | 23 | result = barcode_scanner_flow.Process(frame, draw=True) 24 | 25 | frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) 26 | 27 | # Display the resulting frame 28 | cv2.imshow('frame', frame) 29 | 30 | # The 'q' button is set as the 31 | # quitting button you may use any 32 | # desired button of your choice 33 | if cv2.waitKey(1) & 0xFF == ord('q'): 34 | break 35 | 36 | # After the loop release the cap object 37 | vid.release() 38 | # Destroy all the windows 39 | cv2.destroyAllWindows() 40 | -------------------------------------------------------------------------------- /include/daisykit/common/types/action.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_ACTION_H_ 16 | #define DAISYKIT_COMMON_TYPES_ACTION_H_ 17 | 18 | namespace daisykit { 19 | namespace types { 20 | 21 | /// Human action enum 22 | /// Currently only supports actions for pushup counter 23 | enum Action { kUnknown = 0, kPushup = 1 }; 24 | 25 | } // namespace types 26 | } // namespace daisykit 27 | 28 | #endif -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMDetector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | 21 | class BitMatrix; 22 | class DetectorResult; 23 | 24 | namespace DataMatrix { 25 | 26 | /** 27 | * @brief Detects a Data Matrix symbol in an image. 28 | */ 29 | DetectorResult Detect(const BitMatrix& image, bool tryHarder, bool tryRotate, bool isPure); 30 | 31 | } // DataMatrix 32 | } // ZXing 33 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class DecoderResult; 24 | class BitMatrix; 25 | 26 | namespace QRCode { 27 | 28 | /** 29 | * @brief Decodes a QR Code from the BitMatrix and the hinted charset. 30 | */ 31 | DecoderResult Decode(const BitMatrix& bits, const std::string& hintedCharset); 32 | 33 | } // QRCode 34 | } // ZXing 35 | -------------------------------------------------------------------------------- /include/daisykit/common/types/keypoint_xyz.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_KEYPOINT_XYZ_H_ 16 | #define DAISYKIT_COMMON_TYPES_KEYPOINT_XYZ_H_ 17 | 18 | namespace daisykit { 19 | namespace types { 20 | 21 | struct KeypointXYZ { 22 | float x; 23 | float y; 24 | float z; 25 | float confidence; /// Prediction probability 26 | }; 27 | 28 | } // namespace types 29 | } // namespace daisykit 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/TextEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 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 19 | 20 | namespace ZXing { 21 | 22 | enum class CharacterSet; 23 | 24 | class TextEncoder 25 | { 26 | static void GetBytes(const std::wstring& str, CharacterSet charset, std::string& bytes); 27 | public: 28 | static std::string FromUnicode(const std::wstring& str, CharacterSet charset) { 29 | std::string r; 30 | GetBytes(str, charset, r); 31 | return r; 32 | } 33 | }; 34 | 35 | } // ZXing 36 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ByteArray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 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 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | /** 24 | ByteArray is an extension of std::vector. 25 | */ 26 | class ByteArray : public std::vector 27 | { 28 | public: 29 | ByteArray() = default; 30 | ByteArray(std::initializer_list list) : std::vector(list) {} 31 | explicit ByteArray(int len) : std::vector(len, 0) {} 32 | }; 33 | 34 | } // ZXing 35 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QREncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | enum class CharacterSet; 24 | 25 | namespace QRCode { 26 | 27 | enum class ErrorCorrectionLevel; 28 | class EncodeResult; 29 | 30 | EncodeResult Encode(const std::wstring& content, ErrorCorrectionLevel ecLevel, CharacterSet encoding, int versionNumber, 31 | bool useGs1Format, int maskPattern = -1); 32 | 33 | } // QRCode 34 | } // ZXing 35 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode93Reader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ODRowReader.h" 20 | 21 | namespace ZXing { 22 | namespace OneD { 23 | 24 | /** 25 | *

Decodes Code 93 barcodes.

26 | * 27 | * @author Sean Owen 28 | * @see Code39Reader 29 | */ 30 | class Code93Reader : public RowReader 31 | { 32 | public: 33 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr&) const override; 34 | }; 35 | 36 | } // OneD 37 | } // ZXing 38 | -------------------------------------------------------------------------------- /include/daisykit/processors/signal_processors/z_score_filter.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_PROCESSORS_SIGNAL_PROCESSORS_Z_SCORE_FILTER_H_ 16 | #define DAISYKIT_PROCESSORS_SIGNAL_PROCESSORS_Z_SCORE_FILTER_H_ 17 | 18 | #include 19 | 20 | namespace daisykit { 21 | namespace processors { 22 | 23 | class ZScoreFilter { 24 | public: 25 | static std::vector Filter(std::vector input); 26 | }; 27 | 28 | } // namespace processors 29 | } // namespace daisykit 30 | 31 | #endif -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRMatrixUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "TritMatrix.h" 20 | 21 | namespace ZXing { 22 | 23 | class BitArray; 24 | 25 | namespace QRCode { 26 | 27 | enum class ErrorCorrectionLevel; 28 | class Version; 29 | 30 | constexpr int NUM_MASK_PATTERNS = 8; 31 | 32 | void BuildMatrix(const BitArray& dataBits, ErrorCorrectionLevel ecLevel, const Version& version, int maskPattern, 33 | TritMatrix& matrix); 34 | 35 | } // QRCode 36 | } // ZXing 37 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/maxicode/MCReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Reader.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | 25 | class DecodeHints; 26 | 27 | namespace MaxiCode { 28 | 29 | class Reader : public ZXing::Reader 30 | { 31 | bool _isPure; 32 | std::string _characterSet; 33 | 34 | public: 35 | explicit Reader(const DecodeHints& hints); 36 | Result decode(const BinaryBitmap& image) const override; 37 | }; 38 | 39 | } // MaxiCode 40 | } // ZXing 41 | -------------------------------------------------------------------------------- /include/daisykit/processors/image_processors/img_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_PROCESSORS_IMAGE_PROCESSORS_IMG_UTILS_H_ 16 | #define DAISYKIT_PROCESSORS_IMAGE_PROCESSORS_IMG_UTILS_H_ 17 | 18 | #include 19 | 20 | namespace daisykit { 21 | namespace processors { 22 | 23 | class ImgUtils { 24 | public: 25 | static cv::Mat SquarePadding(const cv::Mat& img, int target_width = 500); 26 | }; 27 | 28 | } // namespace processors 29 | } // namespace daisykit 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/rss/ODRSSGenericAppIdDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitArray; 24 | enum class DecodeStatus; 25 | 26 | namespace OneD::DataBar { 27 | 28 | DecodeStatus DecodeAppIdGeneralPurposeField(const BitArray& bits, int pos, std::string& result); 29 | DecodeStatus DecodeAppIdAllCodes(const BitArray& bits, int initialPosition, std::string& result); 30 | 31 | } // namespace OneD::DataBar 32 | } // namespace ZXing 33 | -------------------------------------------------------------------------------- /include/daisykit/processors/signal_processors/signal_smoothing.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_PROCESSORS_SIGNAL_PROCESSORS_SIGNAL_SMOOTHING_H_ 16 | #define DAISYKIT_PROCESSORS_SIGNAL_PROCESSORS_SIGNAL_SMOOTHING_H_ 17 | 18 | #include 19 | 20 | namespace daisykit { 21 | namespace processors { 22 | 23 | class SignalSmoothing { 24 | public: 25 | static std::vector MeanFilter1D(std::vector input); 26 | }; 27 | 28 | } // namespace processors 29 | } // namespace daisykit 30 | 31 | #endif -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/maxicode/MCBitMatrixParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | 21 | class ByteArray; 22 | class BitMatrix; 23 | 24 | namespace MaxiCode { 25 | 26 | /** 27 | * @author mike32767 28 | * @author Manuel Kasten 29 | */ 30 | class BitMatrixParser 31 | { 32 | public: 33 | static ByteArray ReadCodewords(const BitMatrix& image); 34 | 35 | static const int MATRIX_WIDTH = 30; 36 | static const int MATRIX_HEIGHT = 33; 37 | }; 38 | 39 | } // MaxiCode 40 | } // ZXing 41 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/BitMatrixIO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2017 Huy Cuong Nguyen 4 | * Copyright 2017 Axel Waggershauser 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | #include "BitMatrix.h" 22 | 23 | namespace ZXing { 24 | 25 | std::string ToString(const BitMatrix& matrix, char one = 'X', char zero = ' ', bool addSpace = true, 26 | bool printAsCString = false); 27 | BitMatrix ParseBitMatrix(const std::string& str, char one = 'X', bool expectSpace = true); 28 | void SaveAsPBM(const BitMatrix& matrix, const std::string filename, int quietZone = 0); 29 | 30 | } // ZXing 31 | -------------------------------------------------------------------------------- /include/daisykit/common/types/box.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_BOX_H_ 16 | #define DAISYKIT_COMMON_TYPES_BOX_H_ 17 | 18 | namespace daisykit { 19 | namespace types { 20 | 21 | struct Box { 22 | Box() {} 23 | Box(float x, float y, float w, float h) : x(x), y(y), w(w), h(h) {} 24 | float x; /// Top left x 25 | float y; /// Top left y 26 | float w; /// Bounding box width 27 | float h; /// Bounding box height 28 | }; 29 | 30 | } // namespace types 31 | } // namespace daisykit 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/graphs/core/transmission_profile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/graphs/core/transmission_profile.h" 16 | 17 | namespace daisykit { 18 | namespace graphs { 19 | 20 | TransmissionProfile::TransmissionProfile(int max_queue_size, bool allow_drop) { 21 | max_queue_size_ = max_queue_size; 22 | allow_drop_ = allow_drop; 23 | }; 24 | 25 | int TransmissionProfile::GetMaxQueueSize() { return max_queue_size_; } 26 | 27 | bool TransmissionProfile::AllowDrop() { return allow_drop_; } 28 | 29 | } // namespace graphs 30 | } // namespace daisykit 31 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/TritMatrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2020 Axel Waggershauser 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 "Matrix.h" 19 | 20 | #include 21 | 22 | namespace ZXing { 23 | 24 | /** 25 | * @brief Represent a tri-state value false/true/empty 26 | */ 27 | class Trit 28 | { 29 | public: 30 | enum value_t : uint8_t {false_v, true_v, empty_v} value = empty_v; 31 | Trit() = default; 32 | Trit(bool v) : value(static_cast(v)) {} 33 | operator bool() const { return value == true_v; } 34 | bool isEmpty() const { return value == empty_v; } 35 | }; 36 | 37 | using TritMatrix = Matrix; 38 | 39 | } // ZXing 40 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode93Writer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders a CODE93 code as a BitMatrix 29 | */ 30 | class Code93Writer 31 | { 32 | public: 33 | Code93Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 34 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 35 | 36 | private: 37 | int _sidesMargin = -1; 38 | }; 39 | 40 | } // OneD 41 | } // ZXing 42 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/maxicode/MCDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class DecoderResult; 24 | class BitMatrix; 25 | 26 | namespace MaxiCode { 27 | 28 | /** 29 | *

The main class which implements MaxiCode decoding -- as opposed to locating and extracting 30 | * the MaxiCode from an image.

31 | * 32 | * @author Manuel Kasten 33 | */ 34 | class Decoder 35 | { 36 | public: 37 | static DecoderResult Decode(const BitMatrix& bits, const std::string& characterSet); 38 | }; 39 | 40 | } // MaxiCode 41 | } // ZXing 42 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMHighLevelEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2006-2007 Jeremias Maerki. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class ByteArray; 24 | 25 | namespace DataMatrix { 26 | 27 | enum class SymbolShape; 28 | 29 | /** 30 | * DataMatrix ECC 200 data encoder following the algorithm described in ISO/IEC 16022:200(E) in 31 | * annex S. 32 | */ 33 | ByteArray Encode(const std::wstring& msg); 34 | ByteArray Encode(const std::wstring& msg, SymbolShape shape, int minWidth, int minHeight, int maxWidth, int maxHeight); 35 | 36 | } // DataMatrix 37 | } // ZXing 38 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/BinaryBitmap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Axel Waggershauser 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "BinaryBitmap.h" 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | struct BinaryBitmap::Cache 24 | { 25 | std::once_flag once; 26 | std::shared_ptr matrix; 27 | }; 28 | 29 | BinaryBitmap::BinaryBitmap(const ImageView& buffer) : _cache(new Cache), _buffer(buffer) {} 30 | 31 | BinaryBitmap::~BinaryBitmap() = default; 32 | 33 | const BitMatrix* BinaryBitmap::getBitMatrix() const 34 | { 35 | std::call_once(_cache->once, [&](){_cache->matrix = getBlackMatrix();}); 36 | return _cache->matrix.get(); 37 | } 38 | 39 | } // ZXing 40 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class DecoderResult; 24 | 25 | namespace Aztec { 26 | 27 | class DetectorResult; 28 | 29 | /** 30 | *

The main class which implements Aztec Code decoding -- as opposed to locating and extracting 31 | * the Aztec Code from an image.

32 | * 33 | * @author David Olivier 34 | */ 35 | class Decoder 36 | { 37 | public: 38 | static DecoderResult Decode(const DetectorResult& detectorResult, const std::string& characterSet); 39 | }; 40 | 41 | } // Aztec 42 | } // ZXing 43 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMECEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2006 Jeremias Maerki. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | 21 | class ByteArray; 22 | 23 | namespace DataMatrix { 24 | 25 | class SymbolInfo; 26 | 27 | /** 28 | * Creates and interleaves the ECC200 error correction for an encoded message. 29 | * 30 | * @param codewords the codewords 31 | * @param symbolInfo information about the symbol to be encoded 32 | * @return the codewords with interleaved error correction. 33 | */ 34 | void EncodeECC200(ByteArray& codewords, const SymbolInfo& symbolInfo); 35 | 36 | } // DataMatrix 37 | } // ZXing 38 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode128Reader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ODRowReader.h" 20 | 21 | namespace ZXing { 22 | 23 | class DecodeHints; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | *

Decodes Code 128 barcodes.

29 | * 30 | * @author Sean Owen 31 | */ 32 | class Code128Reader : public RowReader 33 | { 34 | public: 35 | explicit Code128Reader(const DecodeHints& hints); 36 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr&) const override; 37 | 38 | private: 39 | bool _convertFNC1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /include/daisykit/common/types/feature_set.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_FEATURE_SET_H_ 16 | #define DAISYKIT_COMMON_TYPES_FEATURE_SET_H_ 17 | #include 18 | #include 19 | namespace daisykit { 20 | namespace types { 21 | 22 | /// FeatureSet is a struct that contains a feature vector and its id and name 23 | /// Used in face recognition 24 | struct FeatureSet { 25 | int id; /// ID of the feature 26 | std::string name; /// Name of the feature 27 | std::vector feature; /// Feature vector 28 | }; 29 | 30 | } // namespace types 31 | } // namespace daisykit 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODUPCEWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders an UPC-E code as a {@link BitMatrix}. 29 | * 30 | * @author 0979097955s@gmail.com (RX) 31 | */ 32 | class UPCEWriter 33 | { 34 | public: 35 | UPCEWriter& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Reader.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | 25 | class DecodeHints; 26 | 27 | namespace Aztec { 28 | 29 | /** 30 | * This implementation can detect and decode Aztec codes in an image. 31 | * 32 | * @author David Olivier 33 | */ 34 | class Reader : public ZXing::Reader 35 | { 36 | public: 37 | explicit Reader(const DecodeHints& hints); 38 | Result decode(const BinaryBitmap& image) const override; 39 | 40 | private: 41 | bool _isPure; 42 | std::string _characterSet; 43 | }; 44 | 45 | } // Aztec 46 | } // ZXing 47 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODEAN8Writer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders an EAN8 code as a {@link BitMatrix}. 29 | * 30 | * @author aripollak@gmail.com (Ari Pollak) 31 | */ 32 | class EAN8Writer 33 | { 34 | public: 35 | EAN8Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODITFWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders a ITF code as a {@link BitMatrix}. 29 | * 30 | * @author erik.barbara@gmail.com (Erik Barbara) 31 | */ 32 | class ITFWriter 33 | { 34 | public: 35 | ITFWriter& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFDecodedBitStreamParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace ZXing { 23 | 24 | class DecoderResult; 25 | 26 | namespace Pdf417 { 27 | 28 | /** 29 | *

This class contains the methods for decoding the PDF417 codewords.

30 | * 31 | * @author SITA Lab (kevin.osullivan@sita.aero) 32 | * @author Guenther Grau 33 | */ 34 | class DecodedBitStreamParser 35 | { 36 | public: 37 | static DecoderResult Decode(const std::vector& codewords, int ecLevel, const std::string& characterSet); 38 | }; 39 | 40 | } // Pdf417 41 | } // ZXing 42 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCodabarWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This class renders CodaBar as {@code boolean[]}. 29 | * 30 | * @author dsbnatut@gmail.com (Kazuki Nishiura) 31 | */ 32 | class CodabarWriter 33 | { 34 | public: 35 | CodabarWriter& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODEAN13Writer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders an EAN8 code as a {@link BitMatrix}. 29 | * 30 | * @author aripollak@gmail.com (Ari Pollak) 31 | */ 32 | class EAN13Writer 33 | { 34 | public: 35 | EAN13Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODUPCAWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders a UPC-A code as a {@link BitMatrix}. 29 | * 30 | * @author qwandor@google.com (Andrew Walbran) 31 | */ 32 | class UPCAWriter 33 | { 34 | public: 35 | UPCAWriter& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFHighLevelEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * Copyright 2006 Jeremias Maerki 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 | #include 20 | #include 21 | 22 | namespace ZXing { 23 | 24 | enum class CharacterSet; 25 | 26 | namespace Pdf417 { 27 | 28 | enum class Compaction; 29 | 30 | /** 31 | * PDF417 high-level encoder following the algorithm described in ISO/IEC 15438:2001(E) in 32 | * annex P. 33 | */ 34 | class HighLevelEncoder 35 | { 36 | public: 37 | static std::vector EncodeHighLevel(const std::wstring& msg, Compaction compaction, CharacterSet encoding); 38 | }; 39 | 40 | } // Pdf417 41 | } // ZXing 42 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/CharacterSet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 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 | namespace ZXing { 19 | 20 | enum class CharacterSet 21 | { 22 | Unknown, 23 | ASCII, 24 | ISO8859_1, 25 | ISO8859_2, 26 | ISO8859_3, 27 | ISO8859_4, 28 | ISO8859_5, 29 | ISO8859_6, 30 | ISO8859_7, 31 | ISO8859_8, 32 | ISO8859_9, 33 | ISO8859_10, 34 | ISO8859_11, 35 | ISO8859_13, 36 | ISO8859_14, 37 | ISO8859_15, 38 | ISO8859_16, 39 | Cp437, 40 | Cp1250, 41 | Cp1251, 42 | Cp1252, 43 | Cp1256, 44 | 45 | Shift_JIS, 46 | Big5, 47 | GB2312, 48 | GB18030, 49 | EUC_JP, 50 | EUC_KR, 51 | UnicodeBig, 52 | UTF8, 53 | 54 | BINARY, 55 | 56 | CharsetCount 57 | }; 58 | 59 | } // ZXing 60 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/DecodeStatus.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 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 | namespace ZXing { 19 | 20 | enum class DecodeStatus 21 | { 22 | NoError = 0, 23 | NotFound, 24 | FormatError, 25 | ChecksumError, 26 | }; 27 | 28 | inline bool StatusIsOK(DecodeStatus status) 29 | { 30 | return status == DecodeStatus::NoError; 31 | } 32 | 33 | inline bool StatusIsError(DecodeStatus status) 34 | { 35 | return status != DecodeStatus::NoError; 36 | } 37 | 38 | inline const char* ToString(DecodeStatus status) 39 | { 40 | constexpr const char* names[] = {"NoError", "NotFound", "FormatError", "ChecksumError"}; 41 | return names[static_cast(status)]; 42 | } 43 | 44 | } // ZXing 45 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCodabarReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ODRowReader.h" 20 | 21 | namespace ZXing { 22 | 23 | class DecodeHints; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | *

Decodes Codabar barcodes.

29 | * 30 | * @author Bas Vijfwinkel 31 | * @author David Walker 32 | */ 33 | class CodabarReader : public RowReader 34 | { 35 | public: 36 | explicit CodabarReader(const DecodeHints& hints); 37 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr& state) const override; 38 | 39 | private: 40 | bool _returnStartEnd; 41 | }; 42 | 43 | } // OneD 44 | } // ZXing 45 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode39Writer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders a CODE39 code as a {@link BitMatrix}. 29 | * 30 | * @author erik.barbara@gmail.com (Erik Barbara) 31 | */ 32 | class Code39Writer 33 | { 34 | public: 35 | Code39Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode128Writer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | * This object renders a CODE128 code as a {@link BitMatrix}. 29 | * 30 | * @author erik.barbara@gmail.com (Erik Barbara) 31 | */ 32 | class Code128Writer 33 | { 34 | public: 35 | Code128Writer& setMargin(int sidesMargin) { _sidesMargin = sidesMargin; return *this; } 36 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 37 | 38 | private: 39 | int _sidesMargin = -1; 40 | }; 41 | 42 | } // OneD 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /include/daisykit/common/types/face_search_result.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_FACE_SEARCH_RESULT_H_ 16 | #define DAISYKIT_COMMON_TYPES_FACE_SEARCH_RESULT_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace daisykit { 22 | namespace types { 23 | 24 | /// Face comparison result struct 25 | /// Contains the ID of the face and the min distance of the face to all faces in 26 | /// the database 27 | class FaceSearchResult { 28 | public: 29 | int id; /// ID of the face 30 | float min_distance; /// Min distance of the face to all faces in the database 31 | }; 32 | 33 | } // namespace types 34 | } // namespace daisykit 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ReadBarcode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2019 Axel Waggershauser 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 "DecodeHints.h" 19 | #include "ImageView.h" 20 | #include "Result.h" 21 | 22 | namespace ZXing { 23 | 24 | /** 25 | * Read barcode from an ImageView 26 | * 27 | * @param buffer view of the image data including layout and format 28 | * @param hints optional DecodeHints to parameterize / speed up decoding 29 | * @return #Result structure 30 | */ 31 | Result ReadBarcode(const ImageView& buffer, const DecodeHints& hints = {}); 32 | 33 | // WARNING: this API is experimental and may change/disappear 34 | Results ReadBarcodes(const ImageView& buffer, const DecodeHints& hints = {}); 35 | 36 | } // ZXing 37 | 38 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Reader.h" 20 | #include 21 | 22 | namespace ZXing { 23 | 24 | class DecodeHints; 25 | 26 | namespace DataMatrix { 27 | 28 | /** 29 | * This implementation can detect and decode Data Matrix codes in an image. 30 | * 31 | * @author bbrown@google.com (Brian Brown) 32 | */ 33 | class Reader : public ZXing::Reader 34 | { 35 | bool _tryRotate, _tryHarder, _isPure; 36 | std::string _characterSet; 37 | public: 38 | explicit Reader(const DecodeHints& hints); 39 | Result decode(const BinaryBitmap& image) const override; 40 | }; 41 | 42 | } // DataMatrix 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODDataBarReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * Copyright 2020 Axel Waggershauser 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 | 20 | #include "DecodeHints.h" 21 | #include "ODRowReader.h" 22 | 23 | namespace ZXing { 24 | namespace OneD { 25 | 26 | /** 27 | * Decodes DataBar (formerly known as RSS) sybmols, including truncated and stacked variants. See ISO/IEC 24724:2006. 28 | */ 29 | class DataBarReader : public RowReader 30 | { 31 | 32 | public: 33 | explicit DataBarReader(const DecodeHints& hints); 34 | ~DataBarReader() override; 35 | 36 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr& state) const override; 37 | }; 38 | 39 | } // OneD 40 | } // ZXing 41 | -------------------------------------------------------------------------------- /include/daisykit/common/types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_H_ 16 | #define DAISYKIT_COMMON_TYPES_H_ 17 | 18 | #include "daisykit/common/types/action.h" 19 | #include "daisykit/common/types/box.h" 20 | #include "daisykit/common/types/face.h" 21 | #include "daisykit/common/types/face_extended.h" 22 | #include "daisykit/common/types/face_search_result.h" 23 | #include "daisykit/common/types/feature_set.h" 24 | #include "daisykit/common/types/keypoint.h" 25 | #include "daisykit/common/types/keypoint_xyz.h" 26 | #include "daisykit/common/types/object.h" 27 | #include "daisykit/common/types/object_with_keypoints.h" 28 | #include "daisykit/common/types/object_with_keypoints_xyz.h" 29 | #endif 30 | -------------------------------------------------------------------------------- /include/daisykit/common/types/object.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_OBJECT_H_ 16 | #define DAISYKIT_COMMON_TYPES_OBJECT_H_ 17 | 18 | #include "daisykit/common/types/box.h" 19 | 20 | namespace daisykit { 21 | namespace types { 22 | 23 | /// Object data type. 24 | /// Used in object detection models 25 | struct Object : Box { 26 | Object() {} 27 | Object(float x, float y, float w, float h, int class_id, float confidence) 28 | : Box(x, y, w, h), class_id(class_id), confidence(confidence) {} 29 | int class_id; /// Object class ID 30 | float confidence; /// Detection score 31 | }; 32 | 33 | } // namespace types 34 | } // namespace daisykit 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /include/daisykit/graphs/core/node_type.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_GRAPHS_CORE_NODE_TYPE_H_ 16 | #define DAISYKIT_GRAPHS_CORE_NODE_TYPE_H_ 17 | 18 | namespace daisykit { 19 | namespace graphs { 20 | 21 | /// There are too node types in DaisyKit framework: 22 | /// Synchronous nodes (kSyncNode) processing function Tick() is activated by the 23 | /// previous node, which means all processing pipeline runs node by node. 24 | /// Asynchronous node (kAsyncNode) has a processing thread inside to run 25 | /// processing Tick() in a loop. Thus, these node can run paralelly. 26 | enum NodeType { kSyncNode = 0, kAsyncNode = 1 }; 27 | 28 | } // namespace graphs 29 | } // namespace daisykit 30 | 31 | #endif -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ByteMatrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Matrix.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | 25 | // TODO: If kept at all, this should be replaced by `using ByteMatrix = Matrix;` to be consistent with ByteArray 26 | // This non-template class is kept for now to stay source-compatible with oder versions of the library. 27 | 28 | class ByteMatrix : public Matrix 29 | { 30 | public: 31 | ByteMatrix() = default; 32 | ByteMatrix(int width, int height, int8_t val = 0) : Matrix(width, height, val) {} 33 | ByteMatrix(ByteMatrix&&) = default; 34 | ByteMatrix& operator=(ByteMatrix&&) = default; 35 | }; 36 | 37 | } // ZXing 38 | -------------------------------------------------------------------------------- /src/graphs/core/packet.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/graphs/core/packet.h" 16 | #include "daisykit/common/utils/timer.h" 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace daisykit { 25 | namespace graphs { 26 | 27 | Packet::Packet() { data_available_ = false; } 28 | 29 | Packet::Packet(std::shared_ptr data, utils::TimePoint timestamp) { 30 | // We dont use SetData() here because using mutex lock 31 | // in the constructor causes unpredicted behaviors 32 | data_ = data; 33 | timestamp_ = timestamp; 34 | data_available_ = true; 35 | } 36 | 37 | } // namespace graphs 38 | } // namespace daisykit 39 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRDecoderMetadata.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "CustomData.h" 20 | 21 | namespace ZXing { 22 | namespace QRCode { 23 | 24 | /** 25 | * Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the 26 | * decoding caller. Callers are expected to process this. 27 | */ 28 | 29 | class DecoderMetadata : public CustomData 30 | { 31 | bool _mirrored; 32 | 33 | public: 34 | explicit DecoderMetadata(bool mirrored) : _mirrored(mirrored) {} 35 | 36 | /** 37 | * @return true if the QR Code was mirrored. 38 | */ 39 | bool isMirrored() const { 40 | return _mirrored; 41 | } 42 | }; 43 | 44 | } // QRCode 45 | } // ZXing 46 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Reader.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | 25 | class DecodeHints; 26 | 27 | namespace QRCode { 28 | 29 | /** 30 | * This implementation can detect and decode QR Codes in an image. 31 | * 32 | * @author Sean Owen 33 | */ 34 | class Reader : public ZXing::Reader 35 | { 36 | public: 37 | explicit Reader(const DecodeHints& hints); 38 | Result decode(const BinaryBitmap& image) const override; 39 | 40 | Results decode(const BinaryBitmap& image, int maxSymbols) const override; 41 | 42 | private: 43 | bool _tryHarder, _isPure; 44 | std::string _charset; 45 | }; 46 | 47 | } // QRCode 48 | } // ZXing 49 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODDataBarExpandedReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * Copyright 2020 Axel Waggershauser 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 | 20 | #include "DecodeHints.h" 21 | #include "ODRowReader.h" 22 | 23 | namespace ZXing { 24 | namespace OneD { 25 | 26 | /** 27 | * Decodes DataBarExpandedReader (formerly known as RSS) sybmols, including truncated and stacked variants. See ISO/IEC 24724:2006. 28 | */ 29 | class DataBarExpandedReader : public RowReader 30 | { 31 | 32 | public: 33 | explicit DataBarExpandedReader(const DecodeHints& hints); 34 | ~DataBarExpandedReader() override; 35 | 36 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr& state) const override; 37 | }; 38 | 39 | } // OneD 40 | } // ZXing 41 | -------------------------------------------------------------------------------- /include/daisykit/README.md: -------------------------------------------------------------------------------- 1 | # Coding structure - SDK 2 | 3 | + **daisykit** 4 | + **common** common helpers 5 | + **io** (daisykit::io): read/write files, config, network 6 | + **logging** (daisykit::logging): logging / profilers 7 | + **types** (daisykit::types): data structures and types 8 | + **visualizers** (daisykit::visualizers): visualizers for object detection, segmentation, keypoints... 9 | + **utils** (daisykit::utils): common utilities 10 | + timer.h 11 | + profiler.h (daisykit::profilers): profilers to tracking system performance 12 | + **processors** (daisykit::processors) signal/image processors, basic operations to build computational system. 13 | + **image_processors** 14 | + **signal_processors** 15 | + **trackers** 16 | + **models** (daisykit::models): AI models for CV, NLP or other tasks 17 | + **graphs** (daisykit::graphs): graph API 18 | + **core**: core definitions of graph API 19 | + packet.h 20 | + node.h 21 | + graph.h 22 | ... 23 | + **nodes** (daisykit::graphs::nodes): computational or visualizer nodes. 24 | + **models** 25 | + **image_processors** 26 | + **signal_processors** 27 | + **trackers** 28 | + **flows** (daisykit::flows): completed flows built on graphs, or chain of processors 29 | + **third_party**: lightweight third-party libraries. 30 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZToken.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitArray; 24 | 25 | namespace Aztec { 26 | 27 | class Token 28 | { 29 | public: 30 | void appendTo(BitArray& bitArray, const std::string& text) const; 31 | 32 | static Token CreateSimple(int value, int bitCount) { 33 | return {value, -bitCount}; 34 | } 35 | 36 | static Token CreateBinaryShift(int start, int byteCount) { 37 | return {start, byteCount}; 38 | } 39 | 40 | private: 41 | short _value; 42 | short _count; // is simple token if negative, 43 | 44 | public: 45 | Token(int value, int count) : _value((short)value), _count((short)count) {} 46 | }; 47 | 48 | } // Aztec 49 | } // ZXing 50 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFScanningDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | class ResultPoint; 25 | class DecoderResult; 26 | template class Nullable; 27 | 28 | namespace Pdf417 { 29 | 30 | /** 31 | * @author Guenther Grau 32 | */ 33 | class ScanningDecoder 34 | { 35 | public: 36 | static DecoderResult Decode(const BitMatrix& image, 37 | const Nullable& imageTopLeft, const Nullable& imageBottomLeft, 38 | const Nullable& imageTopRight, const Nullable& imageBottomRight, 39 | int minCodewordWidth, int maxCodewordWidth, const std::string& characterSet); 40 | }; 41 | 42 | } // Pdf417 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODUPCAWriter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Huy Cuong Nguyen 3 | * Copyright 2016 ZXing authors 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 "ODUPCAWriter.h" 19 | 20 | #include "BitMatrix.h" 21 | #include "ODEAN13Writer.h" 22 | 23 | #include 24 | 25 | namespace ZXing::OneD { 26 | 27 | BitMatrix 28 | UPCAWriter::encode(const std::wstring& contents, int width, int height) const 29 | { 30 | // Transform a UPC-A code into the equivalent EAN-13 code, and add a check digit if it is not already present. 31 | size_t length = contents.length(); 32 | if (length != 11 && length != 12) { 33 | throw std::invalid_argument("Requested contents should be 11 or 12 digits long"); 34 | } 35 | return EAN13Writer().setMargin(_sidesMargin).encode(L'0' + contents, width, height); 36 | } 37 | 38 | } // namespace ZXing::OneD 39 | -------------------------------------------------------------------------------- /include/daisykit/flows/barcode_scanner_flow.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_FLOWS_BARCODE_SCANNER_FLOW_H_ 16 | #define DAISYKIT_FLOWS_BARCODE_SCANNER_FLOW_H_ 17 | 18 | #include "ReadBarcode.h" 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __ANDROID__ 24 | #include 25 | #endif 26 | 27 | namespace daisykit { 28 | namespace flows { 29 | class BarcodeScannerFlow { 30 | public: 31 | BarcodeScannerFlow(const std::string& config_str); 32 | std::string Process(cv::Mat& rgb, bool draw = true); 33 | 34 | private: 35 | void DrawRect(cv::Mat& rgb, const ZXing::Position& pos); 36 | ZXing::DecodeHints hints_; 37 | }; 38 | 39 | } // namespace flows 40 | } // namespace daisykit 41 | 42 | #endif -------------------------------------------------------------------------------- /include/daisykit/common/types/object_with_keypoints_xyz.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_OBJECT_WITH_KEYPOINTS_XYZ_H_ 16 | #define DAISYKIT_COMMON_TYPES_OBJECT_WITH_KEYPOINTS_XYZ_H_ 17 | 18 | #include "daisykit/common/types.h" 19 | 20 | #include 21 | 22 | namespace daisykit { 23 | namespace types { 24 | 25 | /// Object with keypoints. 26 | struct ObjectWithKeypointsXYZ : Object { 27 | std::vector keypoints; 28 | 29 | ObjectWithKeypointsXYZ() {} 30 | ObjectWithKeypointsXYZ(const Object& body, 31 | const std::vector& keypoints) 32 | : Object(body), keypoints(keypoints) {} 33 | }; 34 | 35 | } // namespace types 36 | } // namespace daisykit 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFBarcodeValue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace ZXing { 23 | namespace Pdf417 { 24 | 25 | /** 26 | * @author Guenther Grau 27 | */ 28 | class BarcodeValue 29 | { 30 | std::map _values; 31 | 32 | public: 33 | /** 34 | * Add an occurrence of a value 35 | */ 36 | void setValue(int value); 37 | 38 | /** 39 | * Determines the maximum occurrence of a set value and returns all values which were set with this occurrence. 40 | * @return an array of int, containing the values with the highest occurrence, or null, if no value was set 41 | */ 42 | std::vector value() const; 43 | 44 | int confidence(int value) const; 45 | }; 46 | 47 | } // Pdf417 48 | } // ZXing 49 | -------------------------------------------------------------------------------- /include/daisykit/common/utils/timer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_UTILS_TIMER_H_ 16 | #define DAISYKIT_COMMON_UTILS_TIMER_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace daisykit { 22 | namespace utils { 23 | 24 | typedef std::chrono::high_resolution_clock::time_point TimePoint; 25 | 26 | // Timer utility.s 27 | class Timer { 28 | public: 29 | /// Get current time point. 30 | static TimePoint Now(); 31 | /// Get time eslapsed from `start` to `end` time points. 32 | static double CalcTimeElapsedMs(TimePoint start, TimePoint end); 33 | /// Get time eslapsed from `start` to now. 34 | static double CalcTimeElapsedMs(TimePoint start); 35 | }; 36 | 37 | } // namespace utils 38 | } // namespace daisykit 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZWriter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Huy Cuong Nguyen 3 | * Copyright 2016 ZXing authors 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 "AZWriter.h" 19 | 20 | #include "AZEncoder.h" 21 | #include "CharacterSet.h" 22 | #include "TextEncoder.h" 23 | 24 | #include 25 | 26 | namespace ZXing::Aztec { 27 | 28 | Writer::Writer() : 29 | _encoding(CharacterSet::ISO8859_1), 30 | _eccPercent(Encoder::DEFAULT_EC_PERCENT), 31 | _layers(Encoder::DEFAULT_AZTEC_LAYERS) 32 | { 33 | } 34 | 35 | BitMatrix 36 | Writer::encode(const std::wstring& contents, int width, int height) const 37 | { 38 | std::string bytes = TextEncoder::FromUnicode(contents, _encoding); 39 | EncodeResult aztec = Encoder::Encode(bytes, _eccPercent, _layers); 40 | return Inflate(std::move(aztec.matrix), width, height, _margin); 41 | } 42 | 43 | } // namespace ZXing::Aztec 44 | -------------------------------------------------------------------------------- /include/daisykit/common/types/object_with_keypoints.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_OBJECT_WITH_KEYPOINTS_H_ 16 | #define DAISYKIT_COMMON_TYPES_OBJECT_WITH_KEYPOINTS_H_ 17 | 18 | #include "daisykit/common/types/keypoint.h" 19 | #include "daisykit/common/types/object.h" 20 | 21 | #include 22 | 23 | namespace daisykit { 24 | namespace types { 25 | 26 | /// Object with keypoints. 27 | struct ObjectWithKeypoints : Object { 28 | std::vector keypoints; 29 | 30 | ObjectWithKeypoints() {} 31 | ObjectWithKeypoints(const Object& body, 32 | const std::vector& keypoints) 33 | : Object(body), keypoints(keypoints) {} 34 | }; 35 | 36 | } // namespace types 37 | } // namespace daisykit 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODRowReader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Axel Waggershauser 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ODRowReader.h" 18 | 19 | #include "BitArray.h" 20 | #include "Result.h" 21 | 22 | #include 23 | 24 | namespace ZXing::OneD { 25 | 26 | Result RowReader::decodeSingleRow(int rowNumber, const BitArray& row) const 27 | { 28 | std::unique_ptr state; 29 | PatternRow res; 30 | auto li = row.begin(); 31 | auto i = li; 32 | if (*i) 33 | res.push_back(0); 34 | while ((i = row.getNextSetTo(i, !*i)) != row.end()) { 35 | res.push_back(static_cast(i - li)); 36 | li = i; 37 | } 38 | res.push_back(static_cast(i - li)); 39 | if (*(i-1)) 40 | res.push_back(0); 41 | 42 | PatternView view(res); 43 | return decodePattern(rowNumber, view, state); 44 | } 45 | 46 | } // namespace ZXing::OneD 47 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZHighLevelEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitArray; 24 | 25 | namespace Aztec { 26 | 27 | /** 28 | * This produces nearly optimal encodings of text into the first-level of 29 | * encoding used by Aztec code. 30 | * 31 | * It uses a dynamic algorithm. For each prefix of the string, it determines 32 | * a set of encodings that could lead to this prefix. We repeatedly add a 33 | * character and generate a new set of optimal encodings until we have read 34 | * through the entire input. 35 | * 36 | * @author Frank Yellin 37 | * @author Rustam Abdullaev 38 | */ 39 | class HighLevelEncoder 40 | { 41 | public: 42 | static BitArray Encode(const std::string& text); 43 | }; 44 | 45 | } // Aztec 46 | } // ZXing 47 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRDetector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * Copyright 2021 Axel Waggershauser 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 | 20 | #include "ConcentricFinder.h" 21 | 22 | #include 23 | 24 | namespace ZXing { 25 | 26 | class DetectorResult; 27 | class BitMatrix; 28 | 29 | namespace QRCode { 30 | 31 | struct FinderPatternSet 32 | { 33 | ConcentricPattern bl, tl, tr; 34 | }; 35 | 36 | using FinderPatternSets = std::vector; 37 | 38 | FinderPatternSets FindFinderPatternSets(const BitMatrix& image, bool tryHarder); 39 | DetectorResult SampleAtFinderPatternSet(const BitMatrix& image, const FinderPatternSet& fp); 40 | 41 | /** 42 | * @brief Detects a QR Code in an image. 43 | */ 44 | DetectorResult Detect(const BitMatrix& image, bool tryHarder, bool isPure); 45 | 46 | } // QRCode 47 | } // ZXing 48 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Reader.h" 20 | 21 | #include 22 | #include 23 | 24 | namespace ZXing { 25 | 26 | class DecodeHints; 27 | 28 | namespace Pdf417 { 29 | 30 | /** 31 | * This implementation can detect and decode PDF417 codes in an image. 32 | * 33 | * @author Guenther Grau 34 | */ 35 | class Reader : public ZXing::Reader 36 | { 37 | bool _isPure; 38 | std::string _characterSet; 39 | 40 | public: 41 | explicit Reader(const DecodeHints& hints); 42 | 43 | Result decode(const BinaryBitmap& image) const override; 44 | Results decode(const BinaryBitmap& image, int maxSymbols) const override; 45 | 46 | [[deprecated]] std::list decodeMultiple(const BinaryBitmap& image) const; 47 | }; 48 | 49 | } // Pdf417 50 | } // ZXing 51 | -------------------------------------------------------------------------------- /include/daisykit/common/types/face_extended.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_FACE_EXTENDED_H_ 16 | #define DAISYKIT_COMMON_TYPES_FACE_EXTENDED_H_ 17 | #include "daisykit/common/types/face.h" 18 | 19 | #include 20 | 21 | #include 22 | 23 | namespace daisykit { 24 | namespace types { 25 | 26 | /// Extended face object with aligned face and feature vector. 27 | /// This is used for face recognition. 28 | class FaceExtended : public Face { 29 | public: 30 | float liveness_score; 31 | 32 | cv::Mat aligned_face; /// Aligned face. For increasing recognition accuracy, 33 | /// the face should be aligned before recognition. 34 | std::vector feature; /// Feature vector for face recognition 35 | }; 36 | 37 | } // namespace types 38 | } // namespace daisykit 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Reader.h" 20 | 21 | #include 22 | #include 23 | 24 | namespace ZXing { 25 | 26 | class DecodeHints; 27 | 28 | namespace OneD { 29 | 30 | class RowReader; 31 | 32 | /** 33 | * @author dswitkin@google.com (Daniel Switkin) 34 | * @author Sean Owen 35 | */ 36 | class Reader : public ZXing::Reader 37 | { 38 | public: 39 | explicit Reader(const DecodeHints& hints); 40 | ~Reader() override; 41 | 42 | Result decode(const BinaryBitmap& image) const override; 43 | Results decode(const BinaryBitmap& image, int maxSymbols) const override; 44 | 45 | private: 46 | std::vector> _readers; 47 | bool _tryHarder; 48 | bool _tryRotate; 49 | bool _isPure; 50 | }; 51 | 52 | } // OneD 53 | } // ZXing 54 | -------------------------------------------------------------------------------- /include/daisykit/common/types/face.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_TYPES_FACE_H_ 16 | #define DAISYKIT_COMMON_TYPES_FACE_H_ 17 | 18 | #include "daisykit/common/types/box.h" 19 | #include "daisykit/common/types/keypoint.h" 20 | 21 | #include 22 | 23 | namespace daisykit { 24 | namespace types { 25 | 26 | /// Human face data type. 27 | /// Also includes other information such as wearing mask or not, facial landmark 28 | class Face : public Box { 29 | public: 30 | float confidence = 1.0; /// Confidence of face 31 | float wearing_mask_prob = -1; /// Probability of wearing a mask 32 | std::vector landmark; /// Keypoints 33 | 34 | float Area() const { return w * h; } 35 | }; 36 | 37 | } // namespace types 38 | } // namespace daisykit 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRErrorCorrectionLevel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | namespace QRCode { 21 | 22 | /** 23 | *

See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels 24 | * defined by the QR code standard.

25 | * 26 | * @author Sean Owen 27 | */ 28 | enum class ErrorCorrectionLevel 29 | { 30 | Low, // L = ~7 % correction 31 | Medium, // M = ~15% correction 32 | Quality, // Q = ~25% correction 33 | High, // H = ~30% correction 34 | Invalid, // denotes in invalid/unknown value 35 | }; 36 | 37 | const wchar_t* ToString(ErrorCorrectionLevel l); 38 | ErrorCorrectionLevel ECLevelFromString(const char* str); 39 | ErrorCorrectionLevel ECLevelFromBits(int bits); 40 | int BitsFromECLevel(ErrorCorrectionLevel l); 41 | 42 | } // QRCode 43 | } // ZXing 44 | -------------------------------------------------------------------------------- /src/common/utils/timer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/common/utils/timer.h" 16 | 17 | #include 18 | #include 19 | 20 | namespace daisykit { 21 | namespace utils { 22 | 23 | // Get current time point. 24 | TimePoint Timer::Now() { return std::chrono::high_resolution_clock::now(); } 25 | 26 | // Get time eslapsed from `start` to `end` time points. 27 | double Timer::CalcTimeElapsedMs(TimePoint start, TimePoint end) { 28 | double elapsed_time_ms = 29 | std::chrono::duration(end - start).count(); 30 | return elapsed_time_ms; 31 | } 32 | 33 | // Get time eslapsed from `start` to now. 34 | double Timer::CalcTimeElapsedMs(TimePoint start) { 35 | auto now = Now(); 36 | return CalcTimeElapsedMs(start, now); 37 | } 38 | 39 | } // namespace utils 40 | } // namespace daisykit 41 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QREncodeResult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "BitMatrix.h" 20 | #include "ByteArray.h" 21 | #include "QRCodecMode.h" 22 | #include "QRVersion.h" 23 | 24 | namespace ZXing { 25 | namespace QRCode { 26 | 27 | /** 28 | * @author satorux@google.com (Satoru Takabayashi) - creator 29 | * @author dswitkin@google.com (Daniel Switkin) - ported from C++ 30 | * 31 | * Original class name in Java was QRCode, as this name is taken already for the namespace, 32 | * so it's renamed here EncodeResult. 33 | */ 34 | class EncodeResult 35 | { 36 | public: 37 | ErrorCorrectionLevel ecLevel = ErrorCorrectionLevel::Invalid; 38 | CodecMode mode = CodecMode::TERMINATOR; 39 | const Version* version = nullptr; 40 | int maskPattern = -1; 41 | BitMatrix matrix; 42 | }; 43 | 44 | } // QRCode 45 | } // ZXing 46 | -------------------------------------------------------------------------------- /src/processors/signal_processors/signal_smoothing.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/processors/signal_processors/signal_smoothing.h" 16 | 17 | namespace daisykit { 18 | namespace processors { 19 | 20 | std::vector SignalSmoothing::MeanFilter1D(std::vector input) { 21 | std::vector processing_signal; 22 | double runningTotal = 0.0; 23 | int windowSize = 8; 24 | for (int i = 0; i < input.size(); i++) { 25 | runningTotal += input[i]; // add 26 | if (i >= windowSize) runningTotal -= input[i - windowSize]; // subtract 27 | if (i >= (windowSize - 1)) // output moving average 28 | processing_signal.push_back(runningTotal / (double)windowSize); 29 | } 30 | return processing_signal; 31 | } 32 | 33 | } // namespace processors 34 | } // namespace daisykit 35 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "BitMatrix.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | namespace Aztec { 25 | 26 | /** 27 | * Aztec 2D code representation 28 | * 29 | * @author Rustam Abdullaev 30 | */ 31 | struct EncodeResult 32 | { 33 | bool compact; 34 | int size; 35 | int layers; 36 | int codeWords; 37 | BitMatrix matrix; 38 | }; 39 | 40 | /** 41 | * Generates Aztec 2D barcodes. 42 | * 43 | * @author Rustam Abdullaev 44 | */ 45 | class Encoder 46 | { 47 | public: 48 | static const int DEFAULT_EC_PERCENT = 33; // default minimal percentage of error check words 49 | static const int DEFAULT_AZTEC_LAYERS = 0; 50 | 51 | static EncodeResult Encode(const std::string& data, int minECCPercent, int userSpecifiedLayers); 52 | }; 53 | 54 | } // Aztec 55 | } // ZXing 56 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/Scope.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2020 Axel Waggershauser 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 19 | 20 | namespace ZXing { 21 | 22 | /** 23 | * ScopeExit is a trivial helper meant to be later replaced by std::scope_exit from library fundamentals TS v3. 24 | */ 25 | 26 | template 27 | class ScopeExit 28 | { 29 | EF fn; 30 | public: 31 | ScopeExit(EF&& fn) : fn(std::move(fn)) {} 32 | ~ScopeExit() { fn(); } 33 | }; 34 | 35 | template 36 | ScopeExit(EF) -> ScopeExit; 37 | 38 | /** 39 | * The SCOPE_EXIT macro is eliminating the need to give the object a name. 40 | * Example usage: 41 | * SCOPE_EXIT([]{ printf("exiting scope"); }); 42 | */ 43 | 44 | #define SCOPE_EXIT_CAT2(x, y) x##y 45 | #define SCOPE_EXIT_CAT(x, y) SCOPE_EXIT_CAT2(x, y) 46 | #define SCOPE_EXIT const auto SCOPE_EXIT_CAT(scopeExit_, __COUNTER__) = ScopeExit 47 | 48 | } // ZXing 49 | 50 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZDetector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | 21 | class BitMatrix; 22 | 23 | namespace Aztec { 24 | 25 | class DetectorResult; 26 | 27 | /** 28 | * Encapsulates logic that can detect an Aztec Code in an image, even if the Aztec Code 29 | * is rotated or skewed, or partially obscured. 30 | * 31 | * @author David Olivier 32 | * @author Frank Yellin 33 | */ 34 | class Detector 35 | { 36 | public: 37 | /** 38 | * Detects an Aztec Code in an image. 39 | * 40 | * @param isMirror if true, image is a mirror-image of original 41 | * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code 42 | * @throws NotFoundException if no Aztec Code can be found 43 | */ 44 | static DetectorResult Detect(const BitMatrix& image, bool isMirror, bool isPure); 45 | }; 46 | 47 | } // Aztec 48 | } // ZXing 49 | -------------------------------------------------------------------------------- /src/graphs/core/graph.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/graphs/core/graph.h" 16 | #include "daisykit/graphs/core/node.h" 17 | 18 | #include 19 | #include 20 | 21 | namespace daisykit { 22 | namespace graphs { 23 | 24 | void Graph::Connect(Node* prev_node, const std::string& output_name, 25 | Node* next_node, const std::string& input_name, 26 | TransmissionProfile transmit_profile, 27 | bool require_data_on_tick) { 28 | std::shared_ptr connection = std::make_shared( 29 | prev_node, output_name, next_node, input_name, transmit_profile, 30 | require_data_on_tick); 31 | if (prev_node) prev_node->AddOutputConnection(connection); 32 | if (next_node) next_node->AddInputConnection(connection); 33 | } 34 | 35 | } // namespace graphs 36 | } // namespace daisykit 37 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class DecoderResult; 24 | class BitMatrix; 25 | 26 | namespace DataMatrix { 27 | 28 | /** 29 | * @brief Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or "true" is taken 30 | * to mean a black module. 31 | * 32 | * @param bits booleans representing white/black Data Matrix Code modules 33 | * @param characterSet initial character encoding to use as a {@link CharacterSetECI} name string 34 | * @return text and bytes encoded within the Data Matrix Code 35 | * @throws FormatException if the Data Matrix Code cannot be decoded 36 | * @throws ChecksumException if error correction fails 37 | */ 38 | DecoderResult Decode(const BitMatrix& bits, const std::string& characterSet = ""); 39 | 40 | } // DataMatrix 41 | } // ZXing 42 | -------------------------------------------------------------------------------- /include/daisykit/models/face_recognition/face_alignment.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License 14 | 15 | #ifndef FACE_ALIGNMENT_H_ 16 | #define FACE_ALIGNMENT_H_ 17 | 18 | #include 19 | #include "daisykit/common/types.h" 20 | 21 | namespace daisykit { 22 | namespace models { 23 | class FaceAligner { 24 | public: 25 | FaceAligner(); 26 | ~FaceAligner(); 27 | void AlignFace(const cv::Mat& img, daisykit::types::FaceExtended& face); 28 | void AlignMutipleFaces(const cv::Mat& img, 29 | std::vector& faces); 30 | 31 | private: 32 | cv::Mat MeanAxis0(const cv::Mat& src); 33 | cv::Mat ElementwiseMinus(const cv::Mat& A, const cv::Mat& B); 34 | cv::Mat VarAxis0(const cv::Mat& src); 35 | int MatrixRank(cv::Mat M); 36 | cv::Mat SimilarTransform(const cv::Mat& src, const cv::Mat& dst); 37 | }; 38 | 39 | } // namespace models 40 | } // namespace daisykit 41 | #endif 42 | -------------------------------------------------------------------------------- /src/common/profiler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/common/profiler.h" 16 | #include "daisykit/common/utils/timer.h" 17 | 18 | namespace daisykit { 19 | 20 | Profiler::Profiler(double fps_count_duration) { 21 | first_tp_ = utils::Timer::Now(); 22 | } 23 | 24 | double Profiler::Tick() { 25 | // Calculate elapsed time from the last time point that FPS was measured. 26 | const double uptime_sec = utils::Timer::CalcTimeElapsedMs(first_tp_) / 1000.0; 27 | ++frame_count_; 28 | 29 | // Recalculate FPS after a time duration 30 | if (uptime_sec > fps_count_duration_) { 31 | if (uptime_sec == 0) return 0; 32 | current_fps_ = frame_count_ / uptime_sec; 33 | first_tp_ = utils::Timer::Now(); 34 | frame_count_ = 0; 35 | } 36 | return current_fps_; 37 | } 38 | 39 | double Profiler::CurrentFPS() { return current_fps_; } 40 | 41 | } // namespace daisykit 42 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODMultiUPCEANReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "BarcodeFormat.h" 20 | #include "DecodeHints.h" 21 | #include "ODRowReader.h" 22 | 23 | namespace ZXing { 24 | namespace OneD { 25 | 26 | /** 27 | *

A reader that can read all available UPC/EAN formats. If a caller wants to try to 28 | * read all such formats, it is most efficient to use this implementation rather than invoke 29 | * individual readers.

30 | * 31 | * @author Sean Owen 32 | */ 33 | class MultiUPCEANReader : public RowReader 34 | { 35 | public: 36 | explicit MultiUPCEANReader(const DecodeHints& hints); 37 | ~MultiUPCEANReader() override; 38 | 39 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr&) const override; 40 | 41 | private: 42 | bool _canReturnUPCA = false; 43 | DecodeHints _hints; 44 | }; 45 | 46 | } // OneD 47 | } // ZXing 48 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ResultPoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Point.h" 20 | 21 | namespace ZXing { 22 | 23 | /** 24 | *

Encapsulates a point of interest in an image containing a barcode. Typically, this 25 | * would be the location of a finder pattern or the corner of the barcode, for example.

26 | * 27 | * @author Sean Owen 28 | */ 29 | class ResultPoint : public PointF 30 | { 31 | public: 32 | ResultPoint() = default; 33 | ResultPoint(float x, float y) : PointF(x, y) {} 34 | ResultPoint(int x, int y) : PointF(x, y) {} 35 | template ResultPoint(PointT p) : PointF(p) {} 36 | 37 | float x() const { return static_cast(PointF::x); } 38 | float y() const { return static_cast(PointF::y); } 39 | 40 | void set(float x, float y) { *this = PointF(x, y); } 41 | 42 | static float Distance(int aX, int aY, int bX, int bY); 43 | }; 44 | 45 | } // ZXing 46 | -------------------------------------------------------------------------------- /python/examples/background_matting.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import json 3 | from daisykit.utils import get_asset_file 4 | from daisykit import BackgroundMattingFlow 5 | 6 | config = { 7 | "background_matting_model": { 8 | "model": get_asset_file("models/background_matting/erd/erdnet.param"), 9 | "weights": get_asset_file("models/background_matting/erd/erdnet.bin"), 10 | "input_width": 256, 11 | "input_height": 256, 12 | "use_gpu": False 13 | } 14 | } 15 | 16 | # Load background 17 | default_bg_file = get_asset_file("images/background.jpg") 18 | background = cv2.imread(default_bg_file) 19 | background = cv2.cvtColor(background, cv2.COLOR_BGR2RGB) 20 | 21 | background_matting_flow = BackgroundMattingFlow(json.dumps(config), background) 22 | 23 | # Open video stream from webcam 24 | vid = cv2.VideoCapture(0) 25 | 26 | while(True): 27 | 28 | # Capture the video frame 29 | ret, frame = vid.read() 30 | 31 | frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) 32 | 33 | mask = background_matting_flow.Process(frame) 34 | background_matting_flow.DrawResult(frame, mask) 35 | 36 | frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) 37 | 38 | # Display the resulting frame 39 | cv2.imshow('frame', frame) 40 | 41 | # The 'q' button is set as the 42 | # quitting button you may use any 43 | # desired button of your choice 44 | if cv2.waitKey(1) & 0xFF == ord('q'): 45 | break 46 | 47 | # After the loop release the cap object 48 | vid.release() 49 | # Destroy all the windows 50 | cv2.destroyAllWindows() 51 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | enum class CharacterSet; 24 | class BitMatrix; 25 | 26 | namespace Aztec { 27 | 28 | class Writer 29 | { 30 | public: 31 | Writer(); 32 | 33 | Writer& setMargin(int margin) { 34 | _margin = margin; 35 | return *this; 36 | } 37 | 38 | Writer& setEncoding(CharacterSet encoding) { 39 | _encoding = encoding; 40 | return *this; 41 | } 42 | 43 | Writer& setEccPercent(int percent) { 44 | _eccPercent = percent; 45 | return *this; 46 | } 47 | 48 | Writer& setLayers(int layers) { 49 | _layers = layers; 50 | return *this; 51 | } 52 | 53 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 54 | 55 | private: 56 | CharacterSet _encoding; 57 | int _eccPercent; 58 | int _layers; 59 | int _margin = 0; 60 | }; 61 | 62 | } // Aztec 63 | } // ZXing 64 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/ReedSolomonEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "GenericGFPoly.h" 20 | 21 | #include 22 | #include 23 | 24 | namespace ZXing { 25 | 26 | // public only for testing purposes 27 | class ReedSolomonEncoder 28 | { 29 | public: 30 | explicit ReedSolomonEncoder(const GenericGF& field); 31 | 32 | void encode(std::vector& message, int numECCodeWords); 33 | 34 | private: 35 | const GenericGF* _field; 36 | std::list _cachedGenerators; 37 | 38 | const GenericGFPoly& buildGenerator(int degree); 39 | }; 40 | 41 | /** 42 | * @brief ReedSolomonEncode replaces the last numECCodeWords code words in message with error correction code words 43 | */ 44 | inline void ReedSolomonEncode(const GenericGF& field, std::vector& message, int numECCodeWords) 45 | { 46 | ReedSolomonEncoder(field).encode(message, numECCodeWords); 47 | } 48 | 49 | } // namespace ZXing 50 | -------------------------------------------------------------------------------- /src/models/image_model.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/models/image_model.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | namespace daisykit { 22 | namespace models { 23 | 24 | ImageModel::ImageModel(int input_size) { 25 | input_height_ = input_size; 26 | input_width_ = input_size; 27 | } 28 | 29 | ImageModel::ImageModel(int input_width, int input_height) { 30 | input_height_ = input_height; 31 | input_width_ = input_width; 32 | } 33 | 34 | int ImageModel::InputWidth() { return input_width_; } 35 | 36 | int ImageModel::InputHeight() { return input_height_; } 37 | 38 | int ImageModel::InputSize() { 39 | if (input_width_ != input_height_) 40 | std::cerr 41 | << "Input width is different from Input height. Getting input size " 42 | "may be wrong." 43 | << std::endl; 44 | return input_width_; 45 | } 46 | 47 | } // namespace models 48 | } // namespace daisykit 49 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFDetector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ResultPoint.h" 20 | #include "ZXNullable.h" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace ZXing { 27 | 28 | class BitMatrix; 29 | class BinaryBitmap; 30 | enum class DecodeStatus; 31 | 32 | namespace Pdf417 { 33 | 34 | /** 35 | *

Encapsulates logic that can detect a PDF417 Code in an image, even if the 36 | * PDF417 Code is rotated or skewed, or partially obscured.< / p> 37 | * 38 | * @author SITA Lab(kevin.osullivan@sita.aero) 39 | * @author dswitkin@google.com(Daniel Switkin) 40 | * @author Guenther Grau 41 | */ 42 | class Detector 43 | { 44 | public: 45 | struct Result 46 | { 47 | std::shared_ptr bits; 48 | std::list, 8>> points; 49 | }; 50 | 51 | static DecodeStatus Detect(const BinaryBitmap& image, bool multiple, Result& result); 52 | }; 53 | 54 | } // Pdf417 55 | } // ZXing 56 | -------------------------------------------------------------------------------- /include/daisykit/processors/fitness/pushup_analyzer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_PROCESSORS_FITNESS_PUSHUPS_PUSHUP_ANALYZER_H_ 16 | #define DAISYKIT_PROCESSORS_FITNESS_PUSHUPS_PUSHUP_ANALYZER_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace daisykit { 22 | namespace processors { 23 | 24 | /// Push-up analyzer using image and signal processing 25 | class PushupAnalyzer { 26 | public: 27 | PushupAnalyzer(); 28 | int CountPushups(const cv::Mat& rgb, bool is_pushing_up); 29 | 30 | private: 31 | int CountWithNewPoint(double data, bool is_pushing_up); 32 | double CalcOpticalFlow(const cv::Mat& img); 33 | cv::Mat prvs_; 34 | std::vector input_ = {0, 0, 0, 0, 0, 0, 0, 0}; 35 | std::vector pushing_; 36 | bool is_first_frame_ = true; 37 | int count_interval_ = 50; // ms 38 | int current_count_ = 0; 39 | long long int last_count_time_ = 0; 40 | }; 41 | 42 | } // namespace processors 43 | } // namespace daisykit 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/TextUtfEncoding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 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 19 | #include 20 | #include 21 | 22 | namespace ZXing { 23 | namespace TextUtfEncoding { 24 | 25 | std::string ToUtf8(const std::wstring& str); 26 | std::string ToUtf8(const std::wstring& str, const bool angleEscape); 27 | std::wstring FromUtf8(const std::string& utf8); 28 | 29 | void ToUtf8(const std::wstring& str, std::string& utf8); 30 | void AppendUtf16(std::wstring& str, const uint16_t* utf16, size_t length); 31 | void AppendUtf8(std::wstring& str, const uint8_t* utf8, size_t length); 32 | 33 | template 34 | bool IsUtf16HighSurrogate(T c) 35 | { 36 | return (c & 0xfc00) == 0xd800; 37 | } 38 | 39 | template 40 | bool IsUtf16LowSurrogate(T c) 41 | { 42 | return (c & 0xfc00) == 0xdc00; 43 | } 44 | 45 | template 46 | uint32_t CodePointFromUtf16Surrogates(T high, T low) 47 | { 48 | return (uint32_t(high) << 10) + low - 0x35fdc00; 49 | } 50 | 51 | } // namespace TextUtfEncoding 52 | } // namespace ZXing 53 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZEncodingState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "AZToken.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | namespace Aztec { 25 | 26 | class Token; 27 | 28 | /** 29 | * State represents all information about a sequence necessary to generate the current output. 30 | * Note that a state is immutable. 31 | */ 32 | class EncodingState 33 | { 34 | public: 35 | // The list of tokens that we output. If we are in Binary Shift mode, this 36 | // token list does *not* yet included the token for those bytes 37 | std::vector tokens; 38 | 39 | // The current mode of the encoding (or the mode to which we'll return if 40 | // we're in Binary Shift mode. 41 | int mode = 0; 42 | 43 | // If non-zero, the number of most recent bytes that should be output 44 | // in Binary Shift mode. 45 | int binaryShiftByteCount = 0; 46 | 47 | // The total number of bits generated (including Binary Shift). 48 | int bitCount = 0; 49 | }; 50 | 51 | } // Aztec 52 | } // ZXing 53 | -------------------------------------------------------------------------------- /src/processors/image_processors/img_utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/processors/image_processors/img_utils.h" 16 | 17 | namespace daisykit { 18 | namespace processors { 19 | 20 | cv::Mat ImgUtils::SquarePadding(const cv::Mat& img, int target_width) { 21 | int width = img.cols, height = img.rows; 22 | 23 | cv::Mat square = cv::Mat::zeros(target_width, target_width, img.type()); 24 | 25 | int max_dim = (width >= height) ? width : height; 26 | float scale = ((float)target_width) / max_dim; 27 | cv::Rect roi; 28 | if (width >= height) { 29 | roi.width = target_width; 30 | roi.x = 0; 31 | roi.height = height * scale; 32 | roi.y = (target_width - roi.height) / 2; 33 | } else { 34 | roi.y = 0; 35 | roi.height = target_width; 36 | roi.width = width * scale; 37 | roi.x = (target_width - roi.width) / 2; 38 | } 39 | 40 | cv::resize(img, square(roi), roi.size()); 41 | 42 | return square; 43 | } 44 | 45 | } // namespace processors 46 | } // namespace daisykit 47 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/GlobalHistogramBinarizer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "BinaryBitmap.h" 20 | 21 | namespace ZXing { 22 | 23 | /** 24 | * This Binarizer implementation uses the old ZXing global histogram approach. It is suitable 25 | * for low-end mobile devices which don't have enough CPU or memory to use a local thresholding 26 | * algorithm. However, because it picks a global black point, it cannot handle difficult shadows 27 | * and gradients. 28 | * 29 | * Faster mobile devices and all desktop applications should probably use HybridBinarizer instead. 30 | * 31 | * @author dswitkin@google.com (Daniel Switkin) 32 | * @author Sean Owen 33 | */ 34 | class GlobalHistogramBinarizer : public BinaryBitmap 35 | { 36 | public: 37 | explicit GlobalHistogramBinarizer(const ImageView& buffer); 38 | ~GlobalHistogramBinarizer() override; 39 | 40 | bool getPatternRow(int row, int rotation, PatternRow &res) const override; 41 | std::shared_ptr getBlackMatrix() const override; 42 | }; 43 | 44 | } // ZXing 45 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/datamatrix/DMWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Huy Cuong Nguyen 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | 23 | class BitMatrix; 24 | 25 | namespace DataMatrix { 26 | 27 | enum class SymbolShape; 28 | 29 | class Writer 30 | { 31 | public: 32 | Writer(); 33 | 34 | Writer& setMargin(int margin) { 35 | _quietZone = margin; 36 | return *this; 37 | } 38 | 39 | Writer& setShapeHint(SymbolShape shape) { 40 | _shapeHint = shape; 41 | return *this; 42 | } 43 | 44 | Writer& setMinSize(int width, int height) { 45 | _minWidth = width; 46 | _minHeight = height; 47 | return *this; 48 | } 49 | 50 | Writer& setMaxSize(int width, int height) { 51 | _maxWidth = width; 52 | _maxHeight = height; 53 | return *this; 54 | } 55 | 56 | BitMatrix encode(const std::wstring& contents, int width, int height) const; 57 | 58 | private: 59 | SymbolShape _shapeHint; 60 | int _quietZone = 1, _minWidth = -1, _minHeight = -1, _maxWidth = -1, _maxHeight = -1; 61 | }; 62 | 63 | } // DataMatrix 64 | } // ZXing 65 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFCodewordDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | namespace ZXing { 22 | namespace Pdf417 { 23 | 24 | /** 25 | * @author Guenther Grau 26 | * @author creatale GmbH (christoph.schulz@creatale.de) 27 | */ 28 | class CodewordDecoder 29 | { 30 | public: 31 | static const int NUMBER_OF_CODEWORDS = 929; 32 | // Maximum Codewords (Data + Error). 33 | static const int MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1; 34 | // One left row indication column + max 30 data columns + one right row indicator column 35 | //public static final int MAX_CODEWORDS_IN_ROW = 32; 36 | static const int MODULES_IN_CODEWORD = 17; 37 | static const int BARS_IN_MODULE = 8; 38 | 39 | /** 40 | * @param symbol encoded symbol to translate to a codeword 41 | * @return the codeword corresponding to the symbol. 42 | */ 43 | static int GetCodeword(int symbol); 44 | 45 | static int GetDecodedValue(const std::array& moduleBitCount); 46 | }; 47 | 48 | } // Pdf417 49 | } // ZXing 50 | -------------------------------------------------------------------------------- /include/daisykit/graphs/core/transmission_profile.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_GRAPHS_CORE_TRANSMISSION_PROFILE_H_ 16 | #define DAISYKIT_GRAPHS_CORE_TRANSMISSION_PROFILE_H_ 17 | 18 | namespace daisykit { 19 | namespace graphs { 20 | 21 | /// Transmission Profile for connections between nodes in DaisyKit. 22 | /// Defines the queue size, dropping and other transmission properties. 23 | /// Used in transmission rules to handle packets. 24 | class TransmissionProfile { 25 | public: 26 | /// Constructor for transmission profile. 27 | TransmissionProfile(int max_queue_size = 5, bool allow_drop = true); 28 | 29 | /// Get max queue size of transmission. 30 | int GetMaxQueueSize(); 31 | 32 | /// Alow drop packets when queue is full? 33 | bool AllowDrop(); 34 | 35 | private: 36 | int max_queue_size_; /// Max queue size for the connection 37 | bool allow_drop_; /// Allow dropping input packets if processing capacity is 38 | /// full 39 | }; 40 | 41 | } // namespace graphs 42 | } // namespace daisykit 43 | 44 | #endif -------------------------------------------------------------------------------- /python/examples/hand_pose_detection.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import json 3 | from daisykit.utils import get_asset_file, to_py_type 4 | from daisykit import HandPoseDetectorFlow 5 | 6 | config = { 7 | "hand_detection_model": { 8 | "model": get_asset_file("models/hand_pose/yolox_hand_swish.param"), 9 | "weights": get_asset_file("models/hand_pose/yolox_hand_swish.bin"), 10 | "input_width": 256, 11 | "input_height": 256, 12 | "score_threshold": 0.45, 13 | "iou_threshold": 0.65, 14 | "use_gpu": False 15 | }, 16 | "hand_pose_model": { 17 | "model": get_asset_file("models/hand_pose/hand_lite-op.param"), 18 | "weights": get_asset_file("models/hand_pose/hand_lite-op.bin"), 19 | "input_size": 224, 20 | "use_gpu": False 21 | } 22 | } 23 | 24 | flow = HandPoseDetectorFlow(json.dumps(config)) 25 | 26 | # Open video stream from webcam 27 | vid = cv2.VideoCapture(0) 28 | 29 | while(True): 30 | 31 | # Capture the video frame 32 | ret, frame = vid.read() 33 | 34 | frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) 35 | 36 | poses = flow.Process(frame) 37 | flow.DrawResult(frame, poses) 38 | 39 | frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) 40 | 41 | # Convert poses to Python list of dict 42 | poses = to_py_type(poses) 43 | 44 | # Display the resulting frame 45 | cv2.imshow('frame', frame) 46 | 47 | # The 'q' button is set as the 48 | # quitting button you may use any 49 | # desired button of your choice 50 | if cv2.waitKey(1) & 0xFF == ord('q'): 51 | break 52 | 53 | # After the loop release the cap object 54 | vid.release() 55 | # Destroy all the windows 56 | cv2.destroyAllWindows() 57 | -------------------------------------------------------------------------------- /toolchains/iosxc-arm64.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # Standard settings 2 | # set(UNIX True) 3 | # set(Darwin True) 4 | # set(IOS True) 5 | set (CMAKE_SYSTEM_NAME Darwin) 6 | set (CMAKE_SYSTEM_VERSION 1) 7 | set (UNIX True) 8 | set (APPLE True) 9 | set (IOS True) 10 | 11 | # suppress -rdynamic 12 | # set(CMAKE_SYSTEM_NAME Generic) 13 | 14 | set(CMAKE_C_COMPILER arm-apple-darwin11-clang) 15 | set(CMAKE_CXX_COMPILER arm-apple-darwin11-clang++) 16 | 17 | set(_CMAKE_TOOLCHAIN_PREFIX arm-apple-darwin11-) 18 | 19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target/SDK/iPhoneOS10.2.sdk") 20 | 21 | # Set the sysroot default to the most recent SDK 22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") 23 | 24 | # set the architecture for iOS 25 | set(IOS_ARCH arm64) 26 | 27 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS") 28 | 29 | if(NOT DEFINED ENABLE_BITCODE) 30 | # enable bitcode support by default 31 | set(ENABLE_BITCODE TRUE CACHE BOOL "enable bitcode") 32 | endif() 33 | 34 | if(ENABLE_BITCODE) 35 | # enable bitcode 36 | set(CMAKE_C_FLAGS "-fembed-bitcode ${CMAKE_C_FLAGS}") 37 | set(CMAKE_CXX_FLAGS "-fembed-bitcode ${CMAKE_CXX_FLAGS}") 38 | endif() 39 | 40 | # Set the find root to the iOS developer roots and to user defined paths 41 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root") 42 | 43 | # searching for frameworks only 44 | set(CMAKE_FIND_FRAMEWORK FIRST) 45 | 46 | # set up the default search directories for frameworks 47 | set(CMAKE_SYSTEM_FRAMEWORK_PATH 48 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks 49 | ) 50 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/TextDecoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 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 19 | #include 20 | #include 21 | 22 | namespace ZXing { 23 | 24 | enum class CharacterSet; 25 | 26 | class TextDecoder 27 | { 28 | public: 29 | static CharacterSet DefaultEncoding(); 30 | static CharacterSet GuessEncoding(const uint8_t* bytes, size_t length, CharacterSet fallback = DefaultEncoding()); 31 | 32 | static void Append(std::wstring& str, const uint8_t* bytes, size_t length, CharacterSet charset); 33 | 34 | static void AppendLatin1(std::wstring& str, const std::string& latin1) { 35 | auto ptr = (const uint8_t*)latin1.data(); 36 | str.append(ptr, ptr + latin1.length()); 37 | } 38 | 39 | static std::wstring FromLatin1(const std::string& latin1) { 40 | auto ptr = (const uint8_t*)latin1.data(); 41 | return std::wstring(ptr, ptr + latin1.length()); 42 | } 43 | 44 | static std::wstring ToUnicode(const std::string& str, CharacterSet charset) { 45 | std::wstring r; 46 | Append(r, (const uint8_t*)str.data(), str.length(), charset); 47 | return r; 48 | } 49 | 50 | }; 51 | 52 | } // ZXing 53 | -------------------------------------------------------------------------------- /toolchains/iosxc.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # Standard settings 2 | # set(UNIX True) 3 | # set(Darwin True) 4 | # set(IOS True) 5 | set (CMAKE_SYSTEM_NAME Darwin) 6 | set (CMAKE_SYSTEM_VERSION 1) 7 | set (UNIX True) 8 | set (APPLE True) 9 | set (IOS True) 10 | 11 | # suppress -rdynamic 12 | # set(CMAKE_SYSTEM_NAME Generic) 13 | 14 | set(CMAKE_C_COMPILER arm-apple-darwin11-clang) 15 | set(CMAKE_CXX_COMPILER arm-apple-darwin11-clang++) 16 | 17 | set(_CMAKE_TOOLCHAIN_PREFIX arm-apple-darwin11-) 18 | 19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target/SDK/iPhoneOS10.2.sdk") 20 | 21 | # Set the sysroot default to the most recent SDK 22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") 23 | 24 | # set the architecture for iOS 25 | # set(IOS_ARCH arm64) 26 | set(IOS_ARCH armv7;arm64) 27 | 28 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS") 29 | 30 | if(NOT DEFINED ENABLE_BITCODE) 31 | # enable bitcode support by default 32 | set(ENABLE_BITCODE TRUE CACHE BOOL "enable bitcode") 33 | endif() 34 | 35 | if(ENABLE_BITCODE) 36 | # enable bitcode 37 | set(CMAKE_C_FLAGS "-fembed-bitcode ${CMAKE_C_FLAGS}") 38 | set(CMAKE_CXX_FLAGS "-fembed-bitcode ${CMAKE_CXX_FLAGS}") 39 | endif() 40 | 41 | # Set the find root to the iOS developer roots and to user defined paths 42 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root") 43 | 44 | # searching for frameworks only 45 | set(CMAKE_FIND_FRAMEWORK FIRST) 46 | 47 | # set up the default search directories for frameworks 48 | set(CMAKE_SYSTEM_FRAMEWORK_PATH 49 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks 50 | ) 51 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRCodecMode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Nu-book Inc. 3 | * Copyright 2016 ZXing authors 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 "QRCodecMode.h" 19 | 20 | #include "QRVersion.h" 21 | 22 | #include 23 | #include 24 | 25 | namespace ZXing::QRCode { 26 | 27 | CodecMode CodecModeForBits(int bits) 28 | { 29 | if ((bits >= 0x00 && bits <= 0x05) || (bits >= 0x07 && bits <= 0x09) || bits == 0x0d) 30 | return static_cast(bits); 31 | 32 | throw std::invalid_argument("Invalid mode"); 33 | } 34 | 35 | int CharacterCountBits(CodecMode mode, const Version& version) 36 | { 37 | int number = version.versionNumber(); 38 | int i; 39 | if (number <= 9) 40 | i = 0; 41 | else if (number <= 26) 42 | i = 1; 43 | else 44 | i = 2; 45 | 46 | switch (mode) { 47 | case CodecMode::NUMERIC: return std::array{10, 12, 14}[i]; 48 | case CodecMode::ALPHANUMERIC: return std::array{9, 11, 13}[i]; 49 | case CodecMode::BYTE: return std::array{8, 16, 16}[i]; 50 | case CodecMode::KANJI: [[fallthrough]]; 51 | case CodecMode::HANZI: return std::array{8, 10, 12}[i]; 52 | default: return 0; 53 | } 54 | } 55 | 56 | } // namespace ZXing::QRCode 57 | -------------------------------------------------------------------------------- /python/examples/human_pose_detection.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import json 3 | from daisykit.utils import get_asset_file, to_py_type 4 | from daisykit import HumanPoseMoveNetFlow 5 | 6 | config = { 7 | "person_detection_model": { 8 | "model": get_asset_file("models/human_detection/ssd_mobilenetv2.param"), 9 | "weights": get_asset_file("models/human_detection/ssd_mobilenetv2.bin"), 10 | "input_width": 320, 11 | "input_height": 320, 12 | "use_gpu": False 13 | }, 14 | "human_pose_model": { 15 | "model": get_asset_file("models/human_pose_detection/movenet/lightning.param"), 16 | "weights": get_asset_file("models/human_pose_detection/movenet/lightning.bin"), 17 | "input_width": 192, 18 | "input_height": 192, 19 | "use_gpu": False 20 | } 21 | } 22 | 23 | human_pose_flow = HumanPoseMoveNetFlow(json.dumps(config)) 24 | 25 | # Open video stream from webcam 26 | vid = cv2.VideoCapture(0) 27 | 28 | while(True): 29 | 30 | # Capture the video frame 31 | ret, frame = vid.read() 32 | 33 | frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) 34 | 35 | poses = human_pose_flow.Process(frame) 36 | human_pose_flow.DrawResult(frame, poses) 37 | 38 | frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) 39 | 40 | # Convert poses to Python list of dict 41 | poses = to_py_type(poses) 42 | 43 | # Display the resulting frame 44 | cv2.imshow('frame', frame) 45 | 46 | # The 'q' button is set as the 47 | # quitting button you may use any 48 | # desired button of your choice 49 | if cv2.waitKey(1) & 0xFF == ord('q'): 50 | break 51 | 52 | # After the loop release the cap object 53 | vid.release() 54 | # Destroy all the windows 55 | cv2.destroyAllWindows() 56 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/MultiFormatReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "Result.h" 20 | 21 | #include 22 | #include 23 | 24 | namespace ZXing { 25 | 26 | class Result; 27 | class Reader; 28 | class BinaryBitmap; 29 | class DecodeHints; 30 | 31 | /** 32 | * MultiFormatReader is a convenience class and the main entry point into the library for most uses. 33 | * By default it attempts to decode all barcode formats that the library supports. Optionally, you 34 | * can provide a hints object to request different behavior, for example only decoding QR codes. 35 | * 36 | * @author Sean Owen 37 | * @author dswitkin@google.com (Daniel Switkin) 38 | */ 39 | class MultiFormatReader 40 | { 41 | public: 42 | explicit MultiFormatReader(const DecodeHints& hints); 43 | ~MultiFormatReader(); 44 | 45 | Result read(const BinaryBitmap& image) const; 46 | 47 | // WARNING: this API is experimental and may change/disappear 48 | Results readMultiple(const BinaryBitmap& image) const; 49 | 50 | private: 51 | std::vector> _readers; 52 | }; 53 | 54 | } // ZXing 55 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZToken.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Huy Cuong Nguyen 3 | * Copyright 2016 ZXing authors 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 "AZToken.h" 19 | 20 | #include "BitArray.h" 21 | 22 | #include 23 | 24 | namespace ZXing::Aztec { 25 | 26 | void 27 | Token::appendTo(BitArray& bitArray, const std::string& text) const 28 | { 29 | if (_count < 0) { 30 | bitArray.appendBits(_value, -_count); 31 | } 32 | else { 33 | for (int i = 0; i < _count; i++) { 34 | if (i == 0 || (i == 31 && _count <= 62)) { 35 | // We need a header before the first character, and before 36 | // character 31 when the total byte code is <= 62 37 | bitArray.appendBits(31, 5); // BINARY_SHIFT 38 | if (_count > 62) { 39 | bitArray.appendBits(_count - 31, 16); 40 | } 41 | else if (i == 0) { 42 | // 1 <= binaryShiftByteCode <= 62 43 | bitArray.appendBits(std::min((int)_count, 31), 5); 44 | } 45 | else { 46 | // 32 <= binaryShiftCount <= 62 and i == 31 47 | bitArray.appendBits(_count - 31, 5); 48 | } 49 | } 50 | bitArray.appendBits(text[_value + i], 8); 51 | } 52 | } 53 | } 54 | 55 | } // namespace ZXing::Aztec 56 | -------------------------------------------------------------------------------- /include/daisykit/flows/object_detector_flow.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_FLOWS_OBJECT_DETECTOR_FLOW_H_ 16 | #define DAISYKIT_FLOWS_OBJECT_DETECTOR_FLOW_H_ 17 | 18 | #include "daisykit/common/types.h" 19 | #include "daisykit/models/hand_detector_yolox.h" 20 | #include "daisykit/models/object_detector_yolox.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #ifdef __ANDROID__ 28 | #include 29 | #endif 30 | 31 | namespace daisykit { 32 | namespace flows { 33 | 34 | /// Object detection flow 35 | class ObjectDetectorFlow { 36 | public: 37 | ObjectDetectorFlow(const std::string& config_str); 38 | #ifdef __ANDROID__ 39 | ObjectDetectorFlow(AAssetManager* mgr, const std::string& config_str); 40 | #endif 41 | 42 | std::vector Process(cv::Mat& rgb); 43 | void DrawResult(cv::Mat& rgb, std::vector& objects); 44 | 45 | private: 46 | models::ObjectDetectorYOLOX* detector_; 47 | }; 48 | 49 | } // namespace flows 50 | } // namespace daisykit 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /toolchains/iossimxc-x64.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # Standard settings 2 | # set(UNIX True) 3 | # set(Darwin True) 4 | # set(IOS True) 5 | set (CMAKE_SYSTEM_NAME Darwin) 6 | set (CMAKE_SYSTEM_VERSION 1) 7 | set (UNIX True) 8 | set (APPLE True) 9 | set (IOS True) 10 | 11 | # suppress -rdynamic 12 | # set(CMAKE_SYSTEM_NAME Generic) 13 | 14 | set(CMAKE_C_COMPILER i386-apple-darwin11-clang) 15 | set(CMAKE_CXX_COMPILER i386-apple-darwin11-clang++) 16 | 17 | set(_CMAKE_TOOLCHAIN_PREFIX i386-apple-darwin11-) 18 | 19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target-sim/SDK/iPhoneSimulator10.2.sdk") 20 | 21 | # Set the sysroot default to the most recent SDK 22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support") 23 | 24 | # set the architecture for iOS 25 | set(IOS_ARCH x86_64) 26 | 27 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator") 28 | 29 | if(NOT DEFINED ENABLE_BITCODE) 30 | # enable bitcode support by default 31 | set(ENABLE_BITCODE TRUE CACHE BOOL "enable bitcode") 32 | endif() 33 | 34 | if(ENABLE_BITCODE) 35 | # enable bitcode 36 | set(CMAKE_C_FLAGS "-fembed-bitcode ${CMAKE_C_FLAGS}") 37 | set(CMAKE_CXX_FLAGS "-fembed-bitcode ${CMAKE_CXX_FLAGS}") 38 | endif() 39 | 40 | # Set the find root to the iOS developer roots and to user defined paths 41 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS Simulator find search path root") 42 | 43 | # searching for frameworks only 44 | set(CMAKE_FIND_FRAMEWORK FIRST) 45 | 46 | # set up the default search directories for frameworks 47 | set(CMAKE_SYSTEM_FRAMEWORK_PATH 48 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks 49 | ) 50 | -------------------------------------------------------------------------------- /include/daisykit/models/image_model.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_MODELS_IMAGE_MODEL_H_ 16 | #define DAISYKIT_MODELS_IMAGE_MODEL_H_ 17 | 18 | #include "net.h" 19 | 20 | #include 21 | 22 | namespace daisykit { 23 | namespace models { 24 | 25 | /// Model interface with image input. 26 | /// All models receiving an image as input should inherite this class. 27 | class ImageModel { 28 | public: 29 | ImageModel(int input_size); 30 | ImageModel(int input_width, int input_height); 31 | 32 | protected: 33 | /// Preprocess function for image model. 34 | /// Get an cv::Mat in and return a net input. 35 | virtual void Preprocess(const cv::Mat& img, ncnn::Mat& net_input) = 0; 36 | /// Get net input width 37 | int InputWidth(); 38 | /// Get net input height 39 | int InputHeight(); 40 | /// Get input size (in case input width = input height) 41 | int InputSize(); 42 | 43 | private: 44 | int input_width_; /// Net input width 45 | int input_height_; /// Net input height 46 | }; 47 | 48 | } // namespace models 49 | } // namespace daisykit 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/daisykit/flows/background_matting_flow.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_FLOWS_BACKGROUND_MATTING_FLOW_H_ 16 | #define DAISYKIT_FLOWS_BACKGROUND_MATTING_FLOW_H_ 17 | 18 | #include "daisykit/models/background_matting.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __ANDROID__ 25 | #include 26 | #endif 27 | 28 | namespace daisykit { 29 | namespace flows { 30 | class BackgroundMattingFlow { 31 | public: 32 | BackgroundMattingFlow(const std::string& config_str, 33 | const cv::Mat& default_background); 34 | #ifdef __ANDROID__ 35 | BackgroundMattingFlow(AAssetManager* mgr, const std::string& config_str, 36 | const cv::Mat& default_background); 37 | #endif 38 | ~BackgroundMattingFlow(); 39 | cv::Mat Process(const cv::Mat& rgb); 40 | void DrawResult(cv::Mat& rgb, const cv::Mat& mask); 41 | 42 | private: 43 | cv::Mat background_; 44 | models::BackgroundMatting* background_matting_model_; 45 | }; 46 | 47 | } // namespace flows 48 | } // namespace daisykit 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/daisykit/flows/human_pose_movenet_flow.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_FLOWS_PUSHUP_COUNTER_FLOW_H_ 16 | #define DAISYKIT_FLOWS_PUSHUP_COUNTER_FLOW_H_ 17 | 18 | #include "daisykit/common/types.h" 19 | #include "daisykit/models/body_detector.h" 20 | #include "daisykit/models/pose_detector_movenet.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #ifdef __ANDROID__ 28 | #include 29 | #endif 30 | 31 | namespace daisykit { 32 | namespace flows { 33 | class HumanPoseMoveNetFlow { 34 | public: 35 | HumanPoseMoveNetFlow(const std::string& config_str); 36 | #ifdef __ANDROID__ 37 | HumanPoseMoveNetFlow(AAssetManager* mgr, const std::string& config_str); 38 | #endif 39 | 40 | std::vector Process(cv::Mat& rgb); 41 | void DrawResult(cv::Mat& rgb, std::vector& poses); 42 | 43 | private: 44 | models::BodyDetector* body_detector_; 45 | models::PoseDetectorMoveNet* pose_detector_; 46 | }; 47 | 48 | } // namespace flows 49 | } // namespace daisykit 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRWriter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Huy Cuong Nguyen 3 | * Copyright 2016 ZXing authors 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 "QRWriter.h" 19 | 20 | #include "BitMatrix.h" 21 | #include "CharacterSet.h" 22 | #include "QREncodeResult.h" 23 | #include "QREncoder.h" 24 | #include "QRErrorCorrectionLevel.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace ZXing::QRCode { 30 | 31 | static const int QUIET_ZONE_SIZE = 4; 32 | 33 | Writer::Writer() : 34 | _margin(QUIET_ZONE_SIZE), 35 | _ecLevel(ErrorCorrectionLevel::Low), 36 | _encoding(CharacterSet::Unknown), 37 | _version(0), 38 | _useGs1Format(false), 39 | _maskPattern(-1) 40 | { 41 | } 42 | 43 | BitMatrix 44 | Writer::encode(const std::wstring& contents, int width, int height) const 45 | { 46 | if (contents.empty()) { 47 | throw std::invalid_argument("Found empty contents"); 48 | } 49 | 50 | if (width < 0 || height < 0) { 51 | throw std::invalid_argument("Requested dimensions are invalid"); 52 | } 53 | 54 | EncodeResult code = Encode(contents, _ecLevel, _encoding, _version, _useGs1Format, _maskPattern); 55 | return Inflate(std::move(code.matrix), width, height, _margin); 56 | } 57 | 58 | } // namespace ZXing::QRCode 59 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFBarcodeMetadata.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | namespace Pdf417 { 21 | 22 | /** 23 | * @author Guenther Grau 24 | */ 25 | class BarcodeMetadata 26 | { 27 | int _columnCount = 0; 28 | int _errorCorrectionLevel = 0; 29 | int _rowCountUpperPart = 0; 30 | int _rowCountLowerPart = 0; 31 | 32 | public: 33 | BarcodeMetadata() = default; 34 | BarcodeMetadata(int columnCount, int rowCountUpperPart, int rowCountLowerPart, int errorCorrectionLevel) 35 | : _columnCount(columnCount), _errorCorrectionLevel(errorCorrectionLevel), _rowCountUpperPart(rowCountUpperPart), 36 | _rowCountLowerPart(rowCountLowerPart) 37 | { 38 | } 39 | 40 | int columnCount() const { 41 | return _columnCount; 42 | } 43 | 44 | int errorCorrectionLevel() const { 45 | return _errorCorrectionLevel; 46 | } 47 | 48 | int rowCount() const { 49 | return _rowCountUpperPart + _rowCountLowerPart; 50 | } 51 | 52 | int rowCountUpperPart() const { 53 | return _rowCountUpperPart; 54 | } 55 | 56 | int rowCountLowerPart() const { 57 | return _rowCountLowerPart; 58 | } 59 | 60 | }; 61 | 62 | } // Pdf417 63 | } // ZXing 64 | -------------------------------------------------------------------------------- /toolchains/iossimxc.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # Standard settings 2 | # set(UNIX True) 3 | # set(Darwin True) 4 | # set(IOS True) 5 | set (CMAKE_SYSTEM_NAME Darwin) 6 | set (CMAKE_SYSTEM_VERSION 1) 7 | set (UNIX True) 8 | set (APPLE True) 9 | set (IOS True) 10 | 11 | # suppress -rdynamic 12 | # set(CMAKE_SYSTEM_NAME Generic) 13 | 14 | set(CMAKE_C_COMPILER i386-apple-darwin11-clang) 15 | set(CMAKE_CXX_COMPILER i386-apple-darwin11-clang++) 16 | 17 | set(_CMAKE_TOOLCHAIN_PREFIX i386-apple-darwin11-) 18 | 19 | set(CMAKE_IOS_SDK_ROOT "/home/nihui/osd/cctools-port/usage_examples/ios_toolchain/target-sim/SDK/iPhoneSimulator10.2.sdk") 20 | 21 | # Set the sysroot default to the most recent SDK 22 | set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support") 23 | 24 | # set the architecture for iOS 25 | # set(IOS_ARCH i386) 26 | # set(IOS_ARCH x86_64) 27 | set(IOS_ARCH i386;x86_64) 28 | 29 | set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS Simulator") 30 | 31 | if(NOT DEFINED ENABLE_BITCODE) 32 | # enable bitcode support by default 33 | set(ENABLE_BITCODE TRUE CACHE BOOL "enable bitcode") 34 | endif() 35 | 36 | if(ENABLE_BITCODE) 37 | # enable bitcode 38 | set(CMAKE_C_FLAGS "-fembed-bitcode ${CMAKE_C_FLAGS}") 39 | set(CMAKE_CXX_FLAGS "-fembed-bitcode ${CMAKE_CXX_FLAGS}") 40 | endif() 41 | 42 | # Set the find root to the iOS developer roots and to user defined paths 43 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS Simulator find search path root") 44 | 45 | # searching for frameworks only 46 | set(CMAKE_FIND_FRAMEWORK FIRST) 47 | 48 | # set up the default search directories for frameworks 49 | set(CMAKE_SYSTEM_FRAMEWORK_PATH 50 | ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks 51 | ) 52 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/pdf417/PDFBarcodeValue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Nu-book Inc. 3 | * Copyright 2016 ZXing authors 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 "PDFBarcodeValue.h" 19 | 20 | #include 21 | 22 | namespace ZXing { 23 | namespace Pdf417 { 24 | 25 | /** 26 | * Add an occurrence of a value 27 | */ 28 | void 29 | BarcodeValue::setValue(int value) 30 | { 31 | _values[value] += 1; 32 | } 33 | 34 | /** 35 | * Determines the maximum occurrence of a set value and returns all values which were set with this occurrence. 36 | * @return an array of int, containing the values with the highest occurrence, or null, if no value was set 37 | */ 38 | std::vector 39 | BarcodeValue::value() const 40 | { 41 | std::vector result; 42 | if (!_values.empty()) { 43 | int maxConfidence = std::max_element(_values.begin(), _values.end(), [](auto& l, auto& r) { return l.second < r.second; })->second; 44 | for (auto [value, count] : _values) 45 | if (count == maxConfidence) 46 | result.push_back(value); 47 | } 48 | return result; 49 | } 50 | 51 | int 52 | BarcodeValue::confidence(int value) const 53 | { 54 | auto it = _values.find(value); 55 | return it != _values.end() ? it->second : 0; 56 | } 57 | 58 | } // Pdf417 59 | } // ZXing 60 | -------------------------------------------------------------------------------- /include/daisykit/graphs/nodes/packet_distributor_node.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_GRAPHS_NODES_PACKET_DISTRIBUTOR_NODE_H_ 16 | #define DAISYKIT_GRAPHS_NODES_PACKET_DISTRIBUTOR_NODE_H_ 17 | 18 | #include "daisykit/graphs/core/node.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace daisykit { 24 | namespace graphs { 25 | 26 | namespace nodes { 27 | 28 | /// This node copy packet from "input" and distribute to "output" 29 | /// Used to copy and distribute packets between nodes 30 | class PacketDistributorNode : public Node { 31 | public: 32 | using Node::Node; // For constructor inheritance 33 | 34 | void Tick() { 35 | // Wait for data 36 | WaitForData(); 37 | 38 | // Prepare input packets 39 | std::map inputs; 40 | PrepareInputs(inputs); 41 | 42 | // Copy input to output 43 | PacketPtr input = inputs["input"]; 44 | std::map outputs; 45 | outputs.insert(std::make_pair("output", input)); 46 | Publish(outputs); 47 | } 48 | }; 49 | 50 | } // namespace nodes 51 | } // namespace graphs 52 | } // namespace daisykit 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/daisykit/common/io/android_assets_stream.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_IO_ANDROID_ASSETS_STREAM_H_ 16 | #define DAISYKIT_IO_ANDROID_ASSETS_STREAM_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | 26 | class AssetStreambuf : public std::streambuf { 27 | public: 28 | AssetStreambuf(AAssetManager* manager, const std::string& filename); 29 | virtual ~AssetStreambuf(); 30 | 31 | std::streambuf::int_type underflow() override; 32 | std::streambuf::int_type overflow(std::streambuf::int_type value) override; 33 | 34 | int sync() override; 35 | 36 | private: 37 | AAssetManager* manager; 38 | AAsset* asset; 39 | std::vector buffer; 40 | }; 41 | 42 | class AssetIStream : public std::istream { 43 | public: 44 | AssetIStream(AAssetManager* manager, const std::string& file); 45 | AssetIStream(const std::string& file); 46 | 47 | virtual ~AssetIStream(); 48 | 49 | static void SetAssetManager(AAssetManager* m); 50 | 51 | private: 52 | static AAssetManager* manager; 53 | }; 54 | 55 | #endif -------------------------------------------------------------------------------- /include/daisykit/graphs/core/graph.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_GRAPHS_CORE_GRAPH_H_ 16 | #define DAISYKIT_GRAPHS_CORE_GRAPH_H_ 17 | 18 | #include "daisykit/graphs/core/node.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace daisykit { 24 | namespace graphs { 25 | 26 | /// Graph class is used to manage nodes, connections and execution tasks in 27 | /// DaisyKit framework 28 | class Graph { 29 | public: 30 | /// Connect 2 nodes by a connection. 31 | /// This utility function create a connection between 2 node in a graph and 32 | /// add that connection to the input/output connection list of each node. 33 | // 34 | /// When `require_data_on_tick` is set to `true`, `next_node` need to wait for 35 | /// the packet from `prev_node` for data at the beginning of each processing 36 | /// round. 37 | static void Connect( 38 | Node* prev_node, const std::string& output_name, Node* next_node, 39 | const std::string& input_name, 40 | TransmissionProfile transmit_profile = TransmissionProfile(), 41 | bool require_data_on_tick = true); 42 | }; 43 | 44 | } // namespace graphs 45 | } // namespace daisykit 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/aztec/AZDetectorResult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "DetectorResult.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | namespace Aztec { 25 | 26 | class DetectorResult : public ZXing::DetectorResult 27 | { 28 | bool _compact = false; 29 | int _nbDatablocks = 0; 30 | int _nbLayers = 0; 31 | bool _readerInit = false; 32 | 33 | DetectorResult(const DetectorResult&) = delete; 34 | DetectorResult& operator=(const DetectorResult&) = delete; 35 | 36 | public: 37 | DetectorResult() = default; 38 | DetectorResult(DetectorResult&&) = default; 39 | DetectorResult& operator=(DetectorResult&&) = default; 40 | 41 | DetectorResult(ZXing::DetectorResult&& result, bool isCompact, int nbDatablocks, int nbLayers, bool readerInit) 42 | : ZXing::DetectorResult{std::move(result)}, _compact(isCompact), _nbDatablocks(nbDatablocks), 43 | _nbLayers(nbLayers), _readerInit(readerInit) 44 | {} 45 | 46 | bool isCompact() const { return _compact; } 47 | int nbDatablocks() const { return _nbDatablocks; } 48 | int nbLayers() const { return _nbLayers; } 49 | bool readerInit() const { return _readerInit; } 50 | }; 51 | 52 | } // Aztec 53 | } // ZXing 54 | -------------------------------------------------------------------------------- /include/daisykit/common/profiler.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef DAISYKIT_COMMON_PROFILER_H_ 16 | #define DAISYKIT_COMMON_PROFILER_H_ 17 | 18 | #include "daisykit/common/utils/timer.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace daisykit { 24 | 25 | /// Profiler to measure system performance. 26 | /// Currently support FPS only 27 | class Profiler { 28 | public: 29 | /// Constructor. 30 | /// FPS will be measure in fps_count_duration (seconds) continuously 31 | Profiler(double fps_count_duration = 10.0); 32 | 33 | /// Run this method once when a processing task is done. 34 | /// Return the current FPS. 35 | double Tick(); 36 | 37 | /// Get current FPS. 38 | double CurrentFPS(); 39 | 40 | private: 41 | utils::TimePoint first_tp_; /// Time point on the last FPS measurement 42 | unsigned long frame_count_ = 0; /// FPS count from the last FPS measurement 43 | double current_fps_ = 0; /// Current FPS 44 | double fps_count_duration_ = 10.0; /// Duration to measure FPS. Should be 45 | /// high enough to get a stable FPS 46 | }; 47 | 48 | } // namespace daisykit 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/oned/ODCode39Reader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ODRowReader.h" 20 | 21 | namespace ZXing { 22 | 23 | class DecodeHints; 24 | 25 | namespace OneD { 26 | 27 | /** 28 | *

Decodes Code 39 barcodes. Supports "Full ASCII Code 39" if extendedMode is true.

29 | * 30 | * @author Sean Owen 31 | * @see Code93Reader 32 | */ 33 | class Code39Reader : public RowReader 34 | { 35 | public: 36 | /** 37 | * Creates a reader that can be configured to check the last character as a check digit, 38 | * or optionally attempt to decode "extended Code 39" sequences that are used to encode 39 | * the full ASCII character set. 40 | * 41 | * @param usingCheckDigit if true, treat the last data character as a check digit, not 42 | * data, and verify that the checksum passes. 43 | * @param extendedMode if true, will attempt to decode extended Code 39 sequences in the 44 | * text. 45 | */ 46 | explicit Code39Reader(const DecodeHints& hints); 47 | 48 | Result decodePattern(int rowNumber, PatternView& next, std::unique_ptr&) const override; 49 | 50 | private: 51 | bool _extendedMode; 52 | bool _usingCheckDigit; 53 | }; 54 | 55 | } // OneD 56 | } // ZXing 57 | -------------------------------------------------------------------------------- /src/examples/demo_face_detector_scrfd.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/common/types.h" 16 | #include "daisykit/common/visualizers/face_visualizer.h" 17 | #include "daisykit/models/face_recognition/face_detector_scrfd.h" 18 | #include "third_party/json.hpp" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | using namespace cv; 28 | using namespace std; 29 | using json = nlohmann::json; 30 | using namespace daisykit; 31 | using namespace daisykit::models; 32 | 33 | FaceDetectorSCRFD* face_detector = 34 | new FaceDetectorSCRFD( 35 | "models/face_detection/scrfd/scrfd_2.5g_1.param", 36 | "models/face_detection/scrfd/scrfd_2.5g_1.bin", 640, 0.7, 0.5, false); 37 | 38 | int main(int, char**) { 39 | Mat frame; 40 | VideoCapture cap(0); 41 | 42 | std::vector faces; 43 | while (1) { 44 | cap >> frame; 45 | face_detector->Predict(frame, faces); 46 | cv::Mat draw = frame.clone(); 47 | visualizers::FaceVisualizer::DrawFace(draw, faces, true); 48 | imshow("Image", draw); 49 | waitKey(1); 50 | } 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRDataMask.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "BitMatrix.h" 20 | 21 | #include 22 | 23 | namespace ZXing { 24 | namespace QRCode { 25 | 26 | /** 27 | *

Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8.

28 | * 29 | *

Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position 30 | * and j is row position. In fact, as the text says, i is row position and j is column position.

31 | */ 32 | 33 | inline bool GetDataMaskBit(int maskIndex, int x, int y) 34 | { 35 | switch (maskIndex) { 36 | case 0: return (y + x) % 2 == 0; 37 | case 1: return y % 2 == 0; 38 | case 2: return x % 3 == 0; 39 | case 3: return (y + x) % 3 == 0; 40 | case 4: return ((y / 2) + (x / 3)) % 2 == 0; 41 | case 5: return (y * x) % 6 == 0; 42 | case 6: return ((y * x) % 6) < 3; 43 | case 7: return (y + x + ((y * x) % 3)) % 2 == 0; 44 | } 45 | throw std::invalid_argument("QRCode maskIndex out of range"); 46 | } 47 | 48 | inline bool GetMaskedBit(const BitMatrix& bits, int x, int y, int maskIndex) 49 | { 50 | return GetDataMaskBit(maskIndex, x, y) != bits.get(x, y); 51 | } 52 | 53 | } // QRCode 54 | } // ZXing 55 | -------------------------------------------------------------------------------- /third_party/zxing-cpp/src/qrcode/QRBitMatrixParser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright 2016 Nu-book Inc. 4 | * Copyright 2016 ZXing authors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace ZXing { 20 | 21 | class BitMatrix; 22 | class ByteArray; 23 | 24 | namespace QRCode { 25 | 26 | class Version; 27 | class FormatInformation; 28 | 29 | /** 30 | * @brief Reads version information from the QR Code. 31 | * @return {@link Version} encapsulating the QR Code's version, nullptr if neither location can be parsed 32 | */ 33 | const Version* ReadVersion(const BitMatrix& bitMatrix); 34 | 35 | /** 36 | * @brief Reads format information from one of its two locations within the QR Code. 37 | * @return {@link FormatInformation} encapsulating the QR Code's format info, result is invalid if both format 38 | * information locations cannot be parsed as the valid encoding of format information 39 | */ 40 | FormatInformation ReadFormatInformation(const BitMatrix& bitMatrix, bool mirrored); 41 | 42 | /** 43 | * @brief Reads the codewords from the BitMatrix. 44 | * @return bytes encoded within the QR Code or empty array if the exact number of bytes expected is not read 45 | */ 46 | ByteArray ReadCodewords(const BitMatrix& bitMatrix, const Version& version, int maskIndex, bool mirrored); 47 | 48 | } // QRCode 49 | } // ZXing 50 | -------------------------------------------------------------------------------- /src/examples/demo_face_detector.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The DaisyKit Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "daisykit/common/types.h" 16 | #include "daisykit/flows/face_detector_flow.h" 17 | #include "third_party/json.hpp" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | using namespace cv; 27 | using namespace std; 28 | using json = nlohmann::json; 29 | using namespace daisykit; 30 | using namespace daisykit::flows; 31 | 32 | int main(int, char**) { 33 | std::ifstream t("configs/face_detector_config.json"); 34 | std::string config_str((std::istreambuf_iterator(t)), 35 | std::istreambuf_iterator()); 36 | 37 | FaceDetectorFlow flow(config_str, true); 38 | 39 | Mat frame; 40 | VideoCapture cap(0); 41 | 42 | while (1) { 43 | cap >> frame; 44 | cv::Mat rgb; 45 | cv::cvtColor(frame, rgb, cv::COLOR_BGR2RGB); 46 | 47 | std::vector faces = flow.Process(rgb); 48 | flow.DrawResult(rgb, faces); 49 | 50 | cv::Mat draw; 51 | cv::cvtColor(rgb, draw, cv::COLOR_RGB2BGR); 52 | imshow("Image", draw); 53 | waitKey(1); 54 | } 55 | 56 | return 0; 57 | } 58 | --------------------------------------------------------------------------------