react-native-executorch 0.4.8 → 0.5.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +17 -0
- package/android/build.gradle +76 -13
- package/android/libs/classes.jar +0 -0
- package/android/src/main/cpp/CMakeLists.txt +73 -0
- package/android/src/main/cpp/ETInstallerModule.cpp +76 -0
- package/android/src/main/cpp/ETInstallerModule.h +43 -0
- package/android/src/main/java/com/swmansion/rnexecutorch/ETInstaller.kt +66 -0
- package/android/src/main/java/com/swmansion/rnexecutorch/LLM.kt +3 -3
- package/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt +7 -113
- package/common/ada/ada.cpp +17406 -0
- package/common/ada/ada.h +10274 -0
- package/common/pfft/pfft.c +2205 -0
- package/common/pfft/pfft.h +185 -0
- package/common/rnexecutorch/Log.h +489 -0
- package/common/rnexecutorch/RnExecutorchInstaller.cpp +78 -0
- package/common/rnexecutorch/RnExecutorchInstaller.h +112 -0
- package/common/rnexecutorch/TokenizerModule.cpp +52 -0
- package/common/rnexecutorch/TokenizerModule.h +26 -0
- package/common/rnexecutorch/data_processing/FFT.cpp +21 -0
- package/common/rnexecutorch/data_processing/FFT.h +23 -0
- package/common/rnexecutorch/data_processing/FileUtils.h +30 -0
- package/common/rnexecutorch/data_processing/ImageProcessing.cpp +240 -0
- package/common/rnexecutorch/data_processing/ImageProcessing.h +55 -0
- package/common/rnexecutorch/data_processing/Numerical.cpp +82 -0
- package/common/rnexecutorch/data_processing/Numerical.h +23 -0
- package/common/rnexecutorch/data_processing/base64.cpp +110 -0
- package/common/rnexecutorch/data_processing/base64.h +46 -0
- package/common/rnexecutorch/data_processing/dsp.cpp +65 -0
- package/common/rnexecutorch/data_processing/dsp.h +12 -0
- package/common/rnexecutorch/host_objects/JSTensorViewIn.h +12 -0
- package/common/rnexecutorch/host_objects/JSTensorViewOut.h +22 -0
- package/common/rnexecutorch/host_objects/JsiConversions.h +410 -0
- package/common/rnexecutorch/host_objects/ModelHostObject.h +239 -0
- package/common/rnexecutorch/jsi/JsiHostObject.cpp +108 -0
- package/common/rnexecutorch/jsi/JsiHostObject.h +87 -0
- package/common/rnexecutorch/jsi/OwningArrayBuffer.h +40 -0
- package/common/rnexecutorch/jsi/Promise.cpp +20 -0
- package/common/rnexecutorch/jsi/Promise.h +69 -0
- package/common/rnexecutorch/jsi/RuntimeAwareCache.h +58 -0
- package/common/rnexecutorch/jsi/RuntimeLifecycleMonitor.cpp +53 -0
- package/common/rnexecutorch/jsi/RuntimeLifecycleMonitor.h +35 -0
- package/common/rnexecutorch/metaprogramming/ConstructorHelpers.h +131 -0
- package/common/rnexecutorch/metaprogramming/FunctionHelpers.h +50 -0
- package/common/rnexecutorch/metaprogramming/TypeConcepts.h +37 -0
- package/common/rnexecutorch/models/BaseModel.cpp +181 -0
- package/common/rnexecutorch/models/BaseModel.h +47 -0
- package/common/rnexecutorch/models/EncoderDecoderBase.cpp +21 -0
- package/common/rnexecutorch/models/EncoderDecoderBase.h +31 -0
- package/common/rnexecutorch/models/classification/Classification.cpp +72 -0
- package/common/rnexecutorch/models/classification/Classification.h +26 -0
- package/{ios/RnExecutorch/models/classification/Constants.mm → common/rnexecutorch/models/classification/Constants.h} +7 -2
- package/common/rnexecutorch/models/embeddings/BaseEmbeddings.cpp +27 -0
- package/common/rnexecutorch/models/embeddings/BaseEmbeddings.h +17 -0
- package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.cpp +45 -0
- package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.h +23 -0
- package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.cpp +61 -0
- package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.h +26 -0
- package/{ios/RnExecutorch/models/image_segmentation/Constants.mm → common/rnexecutorch/models/image_segmentation/Constants.h} +7 -2
- package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.cpp +173 -0
- package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.h +43 -0
- package/{ios/RnExecutorch/utils/Constants.mm → common/rnexecutorch/models/object_detection/Constants.h} +9 -2
- package/common/rnexecutorch/models/object_detection/ObjectDetection.cpp +82 -0
- package/common/rnexecutorch/models/object_detection/ObjectDetection.h +31 -0
- package/{ios/RnExecutorch/utils/ObjectDetectionUtils.mm → common/rnexecutorch/models/object_detection/Utils.cpp} +10 -30
- package/common/rnexecutorch/models/object_detection/Utils.h +17 -0
- package/common/rnexecutorch/models/ocr/CTCLabelConverter.cpp +88 -0
- package/common/rnexecutorch/models/ocr/CTCLabelConverter.h +29 -0
- package/common/rnexecutorch/models/ocr/Constants.h +34 -0
- package/common/rnexecutorch/models/ocr/Detector.cpp +102 -0
- package/common/rnexecutorch/models/ocr/Detector.h +30 -0
- package/common/rnexecutorch/models/ocr/DetectorUtils.cpp +703 -0
- package/common/rnexecutorch/models/ocr/DetectorUtils.h +80 -0
- package/common/rnexecutorch/models/ocr/OCR.cpp +52 -0
- package/common/rnexecutorch/models/ocr/OCR.h +36 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandler.cpp +107 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandler.h +40 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandlerUtils.cpp +153 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandlerUtils.h +72 -0
- package/common/rnexecutorch/models/ocr/Recognizer.cpp +80 -0
- package/common/rnexecutorch/models/ocr/Recognizer.h +36 -0
- package/common/rnexecutorch/models/ocr/RecognizerUtils.cpp +202 -0
- package/common/rnexecutorch/models/ocr/RecognizerUtils.h +70 -0
- package/common/rnexecutorch/models/ocr/Types.h +37 -0
- package/common/rnexecutorch/models/speech_to_text/MoonshineStrategy.cpp +31 -0
- package/common/rnexecutorch/models/speech_to_text/MoonshineStrategy.h +21 -0
- package/common/rnexecutorch/models/speech_to_text/SpeechToText.cpp +70 -0
- package/common/rnexecutorch/models/speech_to_text/SpeechToText.h +31 -0
- package/common/rnexecutorch/models/speech_to_text/SpeechToTextStrategy.h +26 -0
- package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.cpp +38 -0
- package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.h +25 -0
- package/common/rnexecutorch/models/style_transfer/StyleTransfer.cpp +55 -0
- package/common/rnexecutorch/models/style_transfer/StyleTransfer.h +29 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.cpp +92 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.h +49 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.cpp +180 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.h +78 -0
- package/common/rnexecutorch/tests/LogTest.cpp +530 -0
- package/common/rnexecutorch/tests/README.md +20 -0
- package/common/rnexecutorch/tests/run_all_tests.sh +14 -0
- package/common/rnexecutorch/tests/run_test.sh +18 -0
- package/ios/ExecutorchLib.xcframework/Info.plist +4 -4
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
- package/ios/RnExecutorch/ETInstaller.h +8 -0
- package/ios/RnExecutorch/ETInstaller.mm +56 -0
- package/ios/RnExecutorch/utils/Conversions.h +8 -9
- package/ios/RnExecutorch/utils/Numerical.h +2 -0
- package/ios/RnExecutorch.xcodeproj/project.pbxproj +73 -0
- package/lib/common/Logger.d.ts +8 -0
- package/lib/common/Logger.js +19 -0
- package/lib/constants/modelUrls.d.ts +89 -0
- package/lib/constants/modelUrls.js +116 -0
- package/lib/constants/sttDefaults.js +66 -0
- package/lib/controllers/LLMController.js +210 -0
- package/lib/controllers/OCRController.js +65 -0
- package/lib/controllers/SpeechToTextController.d.ts +52 -0
- package/lib/controllers/SpeechToTextController.js +343 -0
- package/lib/hooks/natural_language_processing/useSpeechToText.js +44 -0
- package/lib/index.d.ts +50 -0
- package/{src/index.tsx → lib/index.js} +22 -10
- package/lib/module/Error.js +2 -0
- package/lib/module/Error.js.map +1 -1
- package/lib/module/common/Logger.js +23 -0
- package/lib/module/common/Logger.js.map +1 -0
- package/lib/module/constants/llmDefaults.js +8 -0
- package/lib/module/constants/llmDefaults.js.map +1 -1
- package/lib/module/constants/modelUrls.js +300 -84
- package/lib/module/constants/modelUrls.js.map +1 -1
- package/lib/module/constants/ocr/models.js +181 -286
- package/lib/module/constants/ocr/models.js.map +1 -1
- package/lib/module/constants/ocr/symbols.js +63 -63
- package/lib/module/constants/sttDefaults.js +12 -10
- package/lib/module/constants/sttDefaults.js.map +1 -1
- package/lib/module/controllers/LLMController.js +17 -11
- package/lib/module/controllers/LLMController.js.map +1 -1
- package/lib/module/controllers/OCRController.js +16 -9
- package/lib/module/controllers/OCRController.js.map +1 -1
- package/lib/module/controllers/SpeechToTextController.js +32 -19
- package/lib/module/controllers/SpeechToTextController.js.map +1 -1
- package/lib/module/controllers/VerticalOCRController.js +16 -9
- package/lib/module/controllers/VerticalOCRController.js.map +1 -1
- package/lib/module/hooks/computer_vision/useClassification.js +5 -5
- package/lib/module/hooks/computer_vision/useClassification.js.map +1 -1
- package/lib/module/hooks/computer_vision/useImageEmbeddings.js +13 -0
- package/lib/module/hooks/computer_vision/useImageEmbeddings.js.map +1 -0
- package/lib/module/hooks/computer_vision/useImageSegmentation.js +4 -4
- package/lib/module/hooks/computer_vision/useImageSegmentation.js.map +1 -1
- package/lib/module/hooks/computer_vision/useOCR.js +14 -15
- package/lib/module/hooks/computer_vision/useOCR.js.map +1 -1
- package/lib/module/hooks/computer_vision/useObjectDetection.js +5 -5
- package/lib/module/hooks/computer_vision/useObjectDetection.js.map +1 -1
- package/lib/module/hooks/computer_vision/useStyleTransfer.js +5 -5
- package/lib/module/hooks/computer_vision/useStyleTransfer.js.map +1 -1
- package/lib/module/hooks/computer_vision/useVerticalOCR.js +16 -17
- package/lib/module/hooks/computer_vision/useVerticalOCR.js.map +1 -1
- package/lib/module/hooks/general/useExecutorchModule.js +5 -3
- package/lib/module/hooks/general/useExecutorchModule.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useLLM.js +22 -25
- package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useSpeechToText.js +16 -14
- package/lib/module/hooks/natural_language_processing/useSpeechToText.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js +4 -5
- package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useTokenizer.js +20 -19
- package/lib/module/hooks/natural_language_processing/useTokenizer.js.map +1 -1
- package/lib/module/hooks/useNonStaticModule.js +52 -0
- package/lib/module/hooks/useNonStaticModule.js.map +1 -0
- package/lib/module/index.js +16 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/BaseModule.js +6 -3
- package/lib/module/modules/BaseModule.js.map +1 -1
- package/lib/module/modules/BaseNonStaticModule.js +17 -0
- package/lib/module/modules/BaseNonStaticModule.js.map +1 -0
- package/lib/module/modules/computer_vision/ClassificationModule.js +13 -8
- package/lib/module/modules/computer_vision/ClassificationModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js +19 -0
- package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js.map +1 -0
- package/lib/module/modules/computer_vision/ImageSegmentationModule.js +21 -19
- package/lib/module/modules/computer_vision/ImageSegmentationModule.js.map +1 -1
- package/lib/module/modules/computer_vision/OCRModule.js +13 -10
- package/lib/module/modules/computer_vision/OCRModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ObjectDetectionModule.js +13 -8
- package/lib/module/modules/computer_vision/ObjectDetectionModule.js.map +1 -1
- package/lib/module/modules/computer_vision/StyleTransferModule.js +13 -8
- package/lib/module/modules/computer_vision/StyleTransferModule.js.map +1 -1
- package/lib/module/modules/computer_vision/VerticalOCRModule.js +15 -10
- package/lib/module/modules/computer_vision/VerticalOCRModule.js.map +1 -1
- package/lib/module/modules/general/ExecutorchModule.js +10 -36
- package/lib/module/modules/general/ExecutorchModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/LLMModule.js +18 -22
- package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +27 -16
- package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js +15 -8
- package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/TokenizerModule.js +20 -14
- package/lib/module/modules/natural_language_processing/TokenizerModule.js.map +1 -1
- package/lib/module/native/NativeETInstaller.js +5 -0
- package/lib/module/native/NativeETInstaller.js.map +1 -0
- package/lib/module/native/RnExecutorchModules.js +2 -11
- package/lib/module/native/RnExecutorchModules.js.map +1 -1
- package/lib/module/types/common.js +25 -8
- package/lib/module/types/common.js.map +1 -1
- package/lib/module/types/stt.js +6 -0
- package/lib/module/types/stt.js.map +1 -1
- package/lib/module/utils/ResourceFetcher.js +276 -114
- package/lib/module/utils/ResourceFetcher.js.map +1 -1
- package/lib/module/utils/ResourceFetcherUtils.js +155 -0
- package/lib/module/utils/ResourceFetcherUtils.js.map +1 -0
- package/lib/module/utils/llm.js +41 -1
- package/lib/module/utils/llm.js.map +1 -1
- package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +14 -0
- package/lib/modules/natural_language_processing/SpeechToTextModule.js +30 -0
- package/lib/modules/natural_language_processing/TokenizerModule.js +29 -0
- package/lib/native/RnExecutorchModules.d.ts +3 -0
- package/lib/native/RnExecutorchModules.js +16 -0
- package/lib/typescript/Error.d.ts +2 -0
- package/lib/typescript/Error.d.ts.map +1 -1
- package/lib/typescript/common/Logger.d.ts +9 -0
- package/lib/typescript/common/Logger.d.ts.map +1 -0
- package/lib/typescript/constants/llmDefaults.d.ts +1 -0
- package/lib/typescript/constants/llmDefaults.d.ts.map +1 -1
- package/lib/typescript/constants/modelUrls.d.ts +223 -79
- package/lib/typescript/constants/modelUrls.d.ts.map +1 -1
- package/lib/typescript/constants/ocr/models.d.ts +882 -284
- package/lib/typescript/constants/ocr/models.d.ts.map +1 -1
- package/lib/typescript/constants/sttDefaults.d.ts +1 -0
- package/lib/typescript/constants/sttDefaults.d.ts.map +1 -1
- package/lib/typescript/controllers/LLMController.d.ts +3 -4
- package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
- package/lib/typescript/controllers/OCRController.d.ts +5 -6
- package/lib/typescript/controllers/OCRController.d.ts.map +1 -1
- package/lib/typescript/controllers/SpeechToTextController.d.ts +11 -6
- package/lib/typescript/controllers/SpeechToTextController.d.ts.map +1 -1
- package/lib/typescript/controllers/VerticalOCRController.d.ts +5 -6
- package/lib/typescript/controllers/VerticalOCRController.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useClassification.d.ts +8 -6
- package/lib/typescript/hooks/computer_vision/useClassification.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts +16 -0
- package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts.map +1 -0
- package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts +5 -3
- package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useOCR.d.ts +4 -4
- package/lib/typescript/hooks/computer_vision/useOCR.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts +5 -3
- package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts +5 -3
- package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts +3 -5
- package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts.map +1 -1
- package/lib/typescript/hooks/general/useExecutorchModule.d.ts +1 -1
- package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts +6 -4
- package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +7 -5
- package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts +9 -5
- package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts +6 -4
- package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts.map +1 -1
- package/lib/typescript/hooks/useNonStaticModule.d.ts +21 -0
- package/lib/typescript/hooks/useNonStaticModule.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +18 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modules/BaseModule.d.ts +1 -1
- package/lib/typescript/modules/BaseModule.d.ts.map +1 -1
- package/lib/typescript/modules/BaseNonStaticModule.d.ts +10 -0
- package/lib/typescript/modules/BaseNonStaticModule.d.ts.map +1 -0
- package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts +6 -6
- package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts +9 -0
- package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts.map +1 -0
- package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts +8 -28
- package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/OCRModule.d.ts +8 -7
- package/lib/typescript/modules/computer_vision/OCRModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts +7 -5
- package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts +6 -5
- package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts +7 -8
- package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts.map +1 -1
- package/lib/typescript/modules/general/ExecutorchModule.d.ts +5 -8
- package/lib/typescript/modules/general/ExecutorchModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +16 -16
- package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +19 -9
- package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts +7 -5
- package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts +10 -9
- package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts.map +1 -1
- package/lib/typescript/native/{NativeStyleTransfer.d.ts → NativeETInstaller.d.ts} +2 -3
- package/lib/typescript/native/NativeETInstaller.d.ts.map +1 -0
- package/lib/typescript/native/RnExecutorchModules.d.ts +3 -21
- package/lib/typescript/native/RnExecutorchModules.d.ts.map +1 -1
- package/lib/typescript/types/common.d.ts +30 -2
- package/lib/typescript/types/common.d.ts.map +1 -1
- package/lib/typescript/types/stt.d.ts +5 -1
- package/lib/typescript/types/stt.d.ts.map +1 -1
- package/lib/typescript/utils/ResourceFetcher.d.ts +18 -10
- package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -1
- package/lib/typescript/utils/ResourceFetcherUtils.d.ts +55 -0
- package/lib/typescript/utils/ResourceFetcherUtils.d.ts.map +1 -0
- package/lib/typescript/utils/llm.d.ts +4 -0
- package/lib/typescript/utils/llm.d.ts.map +1 -1
- package/lib/utils/ResourceFetcherUtils.js +119 -0
- package/lib/utils/llm.js +72 -0
- package/package.json +22 -64
- package/react-native-executorch.podspec +75 -3
- package/src/Error.ts +2 -0
- package/src/common/Logger.ts +25 -0
- package/src/constants/llmDefaults.ts +11 -0
- package/src/constants/modelUrls.ts +365 -168
- package/src/constants/ocr/models.ts +826 -395
- package/src/constants/ocr/symbols.ts +63 -63
- package/src/constants/sttDefaults.ts +14 -18
- package/src/controllers/LLMController.ts +28 -18
- package/src/controllers/OCRController.ts +24 -15
- package/src/controllers/SpeechToTextController.ts +53 -40
- package/src/controllers/VerticalOCRController.ts +24 -14
- package/src/hooks/computer_vision/useClassification.ts +10 -11
- package/src/hooks/computer_vision/useImageEmbeddings.ts +15 -0
- package/src/hooks/computer_vision/useImageSegmentation.ts +5 -8
- package/src/hooks/computer_vision/useOCR.ts +29 -21
- package/src/hooks/computer_vision/useObjectDetection.ts +6 -9
- package/src/hooks/computer_vision/useStyleTransfer.ts +6 -6
- package/src/hooks/computer_vision/useVerticalOCR.ts +30 -27
- package/src/hooks/general/useExecutorchModule.ts +3 -3
- package/src/hooks/natural_language_processing/useLLM.ts +38 -28
- package/src/hooks/natural_language_processing/useSpeechToText.ts +34 -26
- package/src/hooks/natural_language_processing/useTextEmbeddings.ts +11 -11
- package/src/hooks/natural_language_processing/useTokenizer.ts +22 -22
- package/src/hooks/useNonStaticModule.ts +74 -0
- package/src/index.ts +108 -0
- package/src/modules/BaseModule.ts +9 -3
- package/src/modules/BaseNonStaticModule.ts +26 -0
- package/src/modules/computer_vision/ClassificationModule.ts +20 -11
- package/src/modules/computer_vision/ImageEmbeddingsModule.ts +26 -0
- package/src/modules/computer_vision/ImageSegmentationModule.ts +35 -27
- package/src/modules/computer_vision/OCRModule.ts +23 -15
- package/src/modules/computer_vision/ObjectDetectionModule.ts +24 -11
- package/src/modules/computer_vision/StyleTransferModule.ts +20 -11
- package/src/modules/computer_vision/VerticalOCRModule.ts +25 -21
- package/src/modules/general/ExecutorchModule.ts +18 -48
- package/src/modules/natural_language_processing/LLMModule.ts +27 -30
- package/src/modules/natural_language_processing/SpeechToTextModule.ts +42 -37
- package/src/modules/natural_language_processing/TextEmbeddingsModule.ts +27 -12
- package/src/modules/natural_language_processing/TokenizerModule.ts +27 -17
- package/src/native/NativeETInstaller.ts +8 -0
- package/src/native/RnExecutorchModules.ts +4 -46
- package/src/types/common.ts +40 -12
- package/src/types/stt.ts +5 -1
- package/src/utils/ResourceFetcher.ts +338 -119
- package/src/utils/ResourceFetcherUtils.ts +186 -0
- package/src/utils/llm.ts +65 -1
- package/third-party/android/libs/executorch/arm64-v8a/libexecutorch.so +0 -0
- package/third-party/android/libs/executorch/x86_64/libexecutorch.so +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_core.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_features2d.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_highgui.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_imgproc.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_photo.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_video.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_core.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_features2d.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_highgui.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_imgproc.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_photo.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_video.a +0 -0
- package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv.a +0 -0
- package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv_hal.a +0 -0
- package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv_thread.a +0 -0
- package/third-party/include/c10/macros/Export.h +163 -0
- package/third-party/include/c10/macros/Macros.h +497 -0
- package/third-party/include/c10/util/BFloat16-inl.h +342 -0
- package/third-party/include/c10/util/BFloat16-math.h +266 -0
- package/third-party/include/c10/util/BFloat16.h +125 -0
- package/third-party/include/c10/util/Half-inl.h +347 -0
- package/third-party/include/c10/util/Half.h +416 -0
- package/third-party/include/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/include/c10/util/bit_cast.h +43 -0
- package/third-party/include/c10/util/floating_point_utils.h +33 -0
- package/third-party/include/c10/util/irange.h +107 -0
- package/third-party/include/executorch/ExecuTorch.h +13 -0
- package/third-party/include/executorch/ExecuTorchError.h +16 -0
- package/third-party/include/executorch/ExecuTorchLog.h +76 -0
- package/third-party/include/executorch/ExecuTorchModule.h +286 -0
- package/third-party/include/executorch/ExecuTorchTensor.h +742 -0
- package/third-party/include/executorch/ExecuTorchValue.h +219 -0
- package/third-party/include/executorch/extension/module/module.h +492 -0
- package/third-party/include/executorch/extension/tensor/tensor.h +13 -0
- package/third-party/include/executorch/extension/tensor/tensor_accessor.h +190 -0
- package/third-party/include/executorch/extension/tensor/tensor_ptr.h +347 -0
- package/third-party/include/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
- package/third-party/include/executorch/runtime/backend/backend_execution_context.h +71 -0
- package/third-party/include/executorch/runtime/backend/backend_init_context.h +72 -0
- package/third-party/include/executorch/runtime/backend/interface.h +166 -0
- package/third-party/include/executorch/runtime/core/array_ref.h +235 -0
- package/third-party/include/executorch/runtime/core/data_loader.h +136 -0
- package/third-party/include/executorch/runtime/core/defines.h +20 -0
- package/third-party/include/executorch/runtime/core/error.h +229 -0
- package/third-party/include/executorch/runtime/core/evalue.h +521 -0
- package/third-party/include/executorch/runtime/core/event_tracer.h +565 -0
- package/third-party/include/executorch/runtime/core/event_tracer_hooks.h +323 -0
- package/third-party/include/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
- package/third-party/include/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
- package/third-party/include/executorch/runtime/core/freeable_buffer.h +107 -0
- package/third-party/include/executorch/runtime/core/hierarchical_allocator.h +107 -0
- package/third-party/include/executorch/runtime/core/memory_allocator.h +198 -0
- package/third-party/include/executorch/runtime/core/named_data_map.h +86 -0
- package/third-party/include/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- package/third-party/include/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- package/third-party/include/executorch/runtime/core/portable_type/bits_types.h +83 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
- package/third-party/include/executorch/runtime/core/portable_type/complex.h +44 -0
- package/third-party/include/executorch/runtime/core/portable_type/device.h +70 -0
- package/third-party/include/executorch/runtime/core/portable_type/half.h +27 -0
- package/third-party/include/executorch/runtime/core/portable_type/optional.h +36 -0
- package/third-party/include/executorch/runtime/core/portable_type/qint_types.h +83 -0
- package/third-party/include/executorch/runtime/core/portable_type/scalar.h +110 -0
- package/third-party/include/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- package/third-party/include/executorch/runtime/core/portable_type/string_view.h +29 -0
- package/third-party/include/executorch/runtime/core/portable_type/tensor.h +142 -0
- package/third-party/include/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
- package/third-party/include/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- package/third-party/include/executorch/runtime/core/result.h +258 -0
- package/third-party/include/executorch/runtime/core/span.h +93 -0
- package/third-party/include/executorch/runtime/core/tag.h +71 -0
- package/third-party/include/executorch/runtime/core/tensor_layout.h +79 -0
- package/third-party/include/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- package/third-party/include/executorch/runtime/executor/memory_manager.h +113 -0
- package/third-party/include/executorch/runtime/executor/method.h +387 -0
- package/third-party/include/executorch/runtime/executor/method_meta.h +251 -0
- package/third-party/include/executorch/runtime/executor/program.h +320 -0
- package/third-party/include/executorch/runtime/executor/pte_data_map.h +144 -0
- package/third-party/include/executorch/runtime/executor/tensor_parser.h +156 -0
- package/third-party/include/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
- package/third-party/include/executorch/runtime/kernel/operator_registry.h +278 -0
- package/third-party/include/executorch/runtime/platform/abort.h +36 -0
- package/third-party/include/executorch/runtime/platform/assert.h +119 -0
- package/third-party/include/executorch/runtime/platform/clock.h +43 -0
- package/third-party/include/executorch/runtime/platform/compat_unistd.h +75 -0
- package/third-party/include/executorch/runtime/platform/compiler.h +191 -0
- package/third-party/include/executorch/runtime/platform/log.h +177 -0
- package/third-party/include/executorch/runtime/platform/platform.h +133 -0
- package/third-party/include/executorch/runtime/platform/profiler.h +292 -0
- package/third-party/include/executorch/runtime/platform/runtime.h +35 -0
- package/third-party/include/executorch/runtime/platform/system.h +49 -0
- package/third-party/include/executorch/runtime/platform/types.h +24 -0
- package/third-party/include/executorch/schema/extended_header.h +76 -0
- package/third-party/include/opencv2/core/affine.hpp +676 -0
- package/third-party/include/opencv2/core/async.hpp +107 -0
- package/third-party/include/opencv2/core/base.hpp +735 -0
- package/third-party/include/opencv2/core/bindings_utils.hpp +279 -0
- package/third-party/include/opencv2/core/bufferpool.hpp +39 -0
- package/third-party/include/opencv2/core/check.hpp +231 -0
- package/third-party/include/opencv2/core/core.hpp +55 -0
- package/third-party/include/opencv2/core/core_c.h +3261 -0
- package/third-party/include/opencv2/core/cv_cpu_dispatch.h +404 -0
- package/third-party/include/opencv2/core/cv_cpu_helper.h +856 -0
- package/third-party/include/opencv2/core/cvdef.h +1003 -0
- package/third-party/include/opencv2/core/cvstd.hpp +196 -0
- package/third-party/include/opencv2/core/cvstd.inl.hpp +188 -0
- package/third-party/include/opencv2/core/cvstd_wrapper.hpp +187 -0
- package/third-party/include/opencv2/core/detail/async_promise.hpp +73 -0
- package/third-party/include/opencv2/core/detail/dispatch_helper.impl.hpp +48 -0
- package/third-party/include/opencv2/core/detail/exception_ptr.hpp +24 -0
- package/third-party/include/opencv2/core/dualquaternion.hpp +1054 -0
- package/third-party/include/opencv2/core/dualquaternion.inl.hpp +464 -0
- package/third-party/include/opencv2/core/eigen.hpp +405 -0
- package/third-party/include/opencv2/core/fast_math.hpp +433 -0
- package/third-party/include/opencv2/core/hal/hal.hpp +451 -0
- package/third-party/include/opencv2/core/hal/interface.h +191 -0
- package/third-party/include/opencv2/core/hal/intrin.hpp +1222 -0
- package/third-party/include/opencv2/core/hal/intrin_avx.hpp +3378 -0
- package/third-party/include/opencv2/core/hal/intrin_avx512.hpp +3688 -0
- package/third-party/include/opencv2/core/hal/intrin_cpp.hpp +3446 -0
- package/third-party/include/opencv2/core/hal/intrin_forward.hpp +195 -0
- package/third-party/include/opencv2/core/hal/intrin_lasx.hpp +3243 -0
- package/third-party/include/opencv2/core/hal/intrin_lsx.hpp +2671 -0
- package/third-party/include/opencv2/core/hal/intrin_math.hpp +772 -0
- package/third-party/include/opencv2/core/hal/intrin_msa.hpp +1973 -0
- package/third-party/include/opencv2/core/hal/intrin_neon.hpp +2710 -0
- package/third-party/include/opencv2/core/hal/intrin_rvv071.hpp +3452 -0
- package/third-party/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2559 -0
- package/third-party/include/opencv2/core/hal/intrin_sse.hpp +3528 -0
- package/third-party/include/opencv2/core/hal/intrin_sse_em.hpp +175 -0
- package/third-party/include/opencv2/core/hal/intrin_vsx.hpp +1756 -0
- package/third-party/include/opencv2/core/hal/intrin_wasm.hpp +2911 -0
- package/third-party/include/opencv2/core/hal/msa_macros.h +2079 -0
- package/third-party/include/opencv2/core/hal/simd_utils.impl.hpp +313 -0
- package/third-party/include/opencv2/core/mat.hpp +3842 -0
- package/third-party/include/opencv2/core/mat.inl.hpp +2753 -0
- package/third-party/include/opencv2/core/matx.hpp +603 -0
- package/third-party/include/opencv2/core/matx.inl.hpp +1132 -0
- package/third-party/include/opencv2/core/neon_utils.hpp +127 -0
- package/third-party/include/opencv2/core/operations.hpp +610 -0
- package/third-party/include/opencv2/core/optim.hpp +362 -0
- package/third-party/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +66 -0
- package/third-party/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +148 -0
- package/third-party/include/opencv2/core/parallel/parallel_backend.hpp +108 -0
- package/third-party/include/opencv2/core/persistence.hpp +1321 -0
- package/third-party/include/opencv2/core/quaternion.hpp +1889 -0
- package/third-party/include/opencv2/core/quaternion.inl.hpp +907 -0
- package/third-party/include/opencv2/core/saturate.hpp +347 -0
- package/third-party/include/opencv2/core/simd_intrinsics.hpp +90 -0
- package/third-party/include/opencv2/core/softfloat.hpp +657 -0
- package/third-party/include/opencv2/core/sse_utils.hpp +861 -0
- package/third-party/include/opencv2/core/traits.hpp +417 -0
- package/third-party/include/opencv2/core/types.hpp +2368 -0
- package/third-party/include/opencv2/core/types_c.h +2064 -0
- package/third-party/include/opencv2/core/utility.hpp +1296 -0
- package/third-party/include/opencv2/core/utils/allocator_stats.hpp +31 -0
- package/third-party/include/opencv2/core/utils/allocator_stats.impl.hpp +111 -0
- package/third-party/include/opencv2/core/utils/filesystem.hpp +91 -0
- package/third-party/include/opencv2/core/utils/fp_control_utils.hpp +70 -0
- package/third-party/include/opencv2/core/utils/instrumentation.hpp +127 -0
- package/third-party/include/opencv2/core/utils/logger.defines.hpp +50 -0
- package/third-party/include/opencv2/core/utils/logger.hpp +258 -0
- package/third-party/include/opencv2/core/utils/logtag.hpp +27 -0
- package/third-party/include/opencv2/core/utils/tls.hpp +230 -0
- package/third-party/include/opencv2/core/utils/trace.hpp +281 -0
- package/third-party/include/opencv2/core/version.hpp +29 -0
- package/third-party/include/opencv2/core/vsx_utils.hpp +1115 -0
- package/third-party/include/opencv2/core.hpp +3699 -0
- package/third-party/include/opencv2/cvconfig.h +155 -0
- package/third-party/include/opencv2/dnn/dnn.hpp +51 -0
- package/third-party/include/opencv2/dnn.hpp +17 -0
- package/third-party/include/opencv2/features2d/features2d.hpp +55 -0
- package/third-party/include/opencv2/features2d/hal/interface.h +32 -0
- package/third-party/include/opencv2/features2d.hpp +1756 -0
- package/third-party/include/opencv2/highgui/highgui.hpp +113 -0
- package/third-party/include/opencv2/highgui.hpp +17 -0
- package/third-party/include/opencv2/imgproc/bindings.hpp +34 -0
- package/third-party/include/opencv2/imgproc/detail/gcgraph.hpp +355 -0
- package/third-party/include/opencv2/imgproc/detail/legacy.hpp +35 -0
- package/third-party/include/opencv2/imgproc/hal/hal.hpp +246 -0
- package/third-party/include/opencv2/imgproc/hal/interface.h +52 -0
- package/third-party/include/opencv2/imgproc/imgproc.hpp +55 -0
- package/third-party/include/opencv2/imgproc/imgproc_c.h +1261 -0
- package/third-party/include/opencv2/imgproc/segmentation.hpp +168 -0
- package/third-party/include/opencv2/imgproc/types_c.h +632 -0
- package/third-party/include/opencv2/imgproc.hpp +5956 -0
- package/third-party/include/opencv2/opencv.hpp +102 -0
- package/third-party/include/opencv2/opencv_modules.hpp +19 -0
- package/third-party/include/opencv2/photo/legacy/constants_c.h +10 -0
- package/third-party/include/opencv2/photo/photo.hpp +55 -0
- package/third-party/include/opencv2/photo.hpp +975 -0
- package/third-party/include/opencv2/video/background_segm.hpp +341 -0
- package/third-party/include/opencv2/video/detail/tracking.detail.hpp +435 -0
- package/third-party/include/opencv2/video/legacy/constants_c.h +15 -0
- package/third-party/include/opencv2/video/tracking.hpp +1014 -0
- package/third-party/include/opencv2/video/video.hpp +55 -0
- package/third-party/include/opencv2/video.hpp +65 -0
- package/third-party/include/tokenizers-cpp/tokenizers_c.h +61 -0
- package/third-party/include/tokenizers-cpp/tokenizers_cpp.h +118 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.h +27 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.mm +249 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.h +14 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.mm +80 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.h +32 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.mm +95 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/InputType.h +12 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Utils.hpp +217 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.cpp +11 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.h +11 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/irunner.h +48 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/runner.cpp +278 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/runner.h +67 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/stats.h +164 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_decoder_runner.cpp +65 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_decoder_runner.h +105 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_prefiller.cpp +91 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_prefiller.h +51 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_token_generator.h +162 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/util.h +108 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/sampler/sampler.cpp +193 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/sampler/sampler.h +64 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/base64.h +202 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.cpp +313 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.h +57 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.cpp +78 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.h +23 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.cpp +427 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.h +87 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tokenizer.h +76 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.pbxproj +683 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/xcuserdata/norbertklockiewicz.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/xcuserdata/norbertklockiewicz.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/third-party/ios/ExecutorchLib/build.sh +44 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64/libbackend_coreml_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64-simulator/libbackend_coreml_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64/libbackend_mps_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64-simulator/libbackend_mps_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64/libbackend_xnnpack_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64-simulator/libbackend_xnnpack_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/Info.plist +47 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorch.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchError.h +16 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchLog.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchModule.h +286 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchTensor.h +742 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchValue.h +219 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/module/module.h +492 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_accessor.h +190 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_execution_context.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_init_context.h +72 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/interface.h +166 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/array_ref.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/data_loader.h +136 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/defines.h +20 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/error.h +229 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/evalue.h +521 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer.h +565 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks.h +323 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/freeable_buffer.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/hierarchical_allocator.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/memory_allocator.h +198 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/named_data_map.h +86 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bits_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/complex.h +44 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/device.h +70 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/half.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/optional.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/qint_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar.h +110 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/string_view.h +29 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor.h +142 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/result.h +258 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/span.h +93 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tag.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_layout.h +79 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/memory_manager.h +113 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method.h +387 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method_meta.h +251 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/program.h +320 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/pte_data_map.h +144 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/tensor_parser.h +156 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/operator_registry.h +278 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/abort.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/assert.h +119 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/clock.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compat_unistd.h +75 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compiler.h +191 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/log.h +177 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/platform.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/profiler.h +292 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/runtime.h +35 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/system.h +49 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/types.h +24 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/schema/extended_header.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/module.modulemap +5 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/libexecutorch_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorch.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchError.h +16 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchLog.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchModule.h +286 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchTensor.h +742 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchValue.h +219 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/module/module.h +492 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_accessor.h +190 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_execution_context.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_init_context.h +72 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/interface.h +166 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/array_ref.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/data_loader.h +136 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/defines.h +20 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/error.h +229 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/evalue.h +521 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer.h +565 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks.h +323 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/freeable_buffer.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/hierarchical_allocator.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/memory_allocator.h +198 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/named_data_map.h +86 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bits_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/complex.h +44 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/device.h +70 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/half.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/optional.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/qint_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar.h +110 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/string_view.h +29 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor.h +142 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/result.h +258 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/span.h +93 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tag.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_layout.h +79 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/memory_manager.h +113 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method.h +387 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method_meta.h +251 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/program.h +320 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/pte_data_map.h +144 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/tensor_parser.h +156 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/operator_registry.h +278 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/abort.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/assert.h +119 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/clock.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compat_unistd.h +75 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compiler.h +191 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/log.h +177 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/platform.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/profiler.h +292 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/runtime.h +35 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/system.h +49 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/types.h +24 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/schema/extended_header.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/module.modulemap +5 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/libexecutorch_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64/libkernels_custom_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64-simulator/libkernels_custom_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64/libkernels_optimized_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64-simulator/libkernels_optimized_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64/libkernels_portable_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64-simulator/libkernels_portable_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64/libkernels_quantized_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64-simulator/libkernels_quantized_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/bitmap256.h +82 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/filtered_re2.h +111 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/pod_array.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter.h +130 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter_tree.h +139 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prog.h +483 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/re2.h +994 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/regexp.h +692 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/set.h +85 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_array.h +367 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_set.h +241 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/stringpiece.h +205 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_casefold.h +78 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_groups.h +64 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/walker-inl.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Info.plist +26 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/re2 +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/bitmap256.h +82 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/filtered_re2.h +111 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/pod_array.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter.h +130 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter_tree.h +139 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prog.h +483 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/re2.h +994 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/regexp.h +692 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/set.h +85 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_array.h +367 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_set.h +241 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/stringpiece.h +205 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_casefold.h +78 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_groups.h +64 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/walker-inl.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Info.plist +26 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/re2 +0 -0
- package/third-party/ios/ios.toolchain.cmake +1122 -0
- package/LICENSE +0 -79
- package/README.md +0 -148
- package/android/src/main/java/com/swmansion/rnexecutorch/Classification.kt +0 -64
- package/android/src/main/java/com/swmansion/rnexecutorch/ETModule.kt +0 -90
- package/android/src/main/java/com/swmansion/rnexecutorch/ImageSegmentation.kt +0 -58
- package/android/src/main/java/com/swmansion/rnexecutorch/OCR.kt +0 -90
- package/android/src/main/java/com/swmansion/rnexecutorch/ObjectDetection.kt +0 -64
- package/android/src/main/java/com/swmansion/rnexecutorch/SpeechToText.kt +0 -91
- package/android/src/main/java/com/swmansion/rnexecutorch/StyleTransfer.kt +0 -54
- package/android/src/main/java/com/swmansion/rnexecutorch/TextEmbeddings.kt +0 -51
- package/android/src/main/java/com/swmansion/rnexecutorch/Tokenizer.kt +0 -86
- package/android/src/main/java/com/swmansion/rnexecutorch/VerticalOCR.kt +0 -179
- package/android/src/main/java/com/swmansion/rnexecutorch/models/BaseModel.kt +0 -54
- package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsModel.kt +0 -48
- package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsUtils.kt +0 -37
- package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/ClassificationModel.kt +0 -46
- package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/Constants.kt +0 -1005
- package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/Constants.kt +0 -26
- package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/ImageSegmentationModel.kt +0 -142
- package/android/src/main/java/com/swmansion/rnexecutorch/models/objectDetection/SSDLiteLargeModel.kt +0 -74
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/Detector.kt +0 -82
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/RecognitionHandler.kt +0 -117
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/Recognizer.kt +0 -51
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/VerticalDetector.kt +0 -89
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/CTCLabelConverter.kt +0 -58
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/Constants.kt +0 -31
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/DetectorUtils.kt +0 -608
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/RecognizerUtils.kt +0 -430
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/BaseS2TDecoder.kt +0 -39
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/BaseS2TModule.kt +0 -43
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/Moonshine.kt +0 -16
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/MoonshineDecoder.kt +0 -23
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/MoonshineEncoder.kt +0 -20
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/Whisper.kt +0 -16
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/WhisperDecoder.kt +0 -22
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/WhisperEncoder.kt +0 -29
- package/android/src/main/java/com/swmansion/rnexecutorch/models/styleTransfer/StyleTransferModel.kt +0 -43
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ArrayUtils.kt +0 -87
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ETError.kt +0 -34
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ImageProcessor.kt +0 -237
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/Numerical.kt +0 -8
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ObjectDetectionUtils.kt +0 -201
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/STFT.kt +0 -50
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/TensorUtils.kt +0 -103
- package/ios/RnExecutorch/Classification.h +0 -5
- package/ios/RnExecutorch/Classification.mm +0 -54
- package/ios/RnExecutorch/ETModule.h +0 -5
- package/ios/RnExecutorch/ETModule.mm +0 -75
- package/ios/RnExecutorch/ImageSegmentation.h +0 -5
- package/ios/RnExecutorch/ImageSegmentation.mm +0 -60
- package/ios/RnExecutorch/OCR.h +0 -5
- package/ios/RnExecutorch/OCR.mm +0 -96
- package/ios/RnExecutorch/ObjectDetection.h +0 -5
- package/ios/RnExecutorch/ObjectDetection.mm +0 -56
- package/ios/RnExecutorch/SpeechToText.h +0 -5
- package/ios/RnExecutorch/SpeechToText.mm +0 -125
- package/ios/RnExecutorch/StyleTransfer.h +0 -5
- package/ios/RnExecutorch/StyleTransfer.mm +0 -55
- package/ios/RnExecutorch/TextEmbeddings.h +0 -5
- package/ios/RnExecutorch/TextEmbeddings.mm +0 -62
- package/ios/RnExecutorch/Tokenizer.h +0 -5
- package/ios/RnExecutorch/Tokenizer.mm +0 -83
- package/ios/RnExecutorch/VerticalOCR.h +0 -5
- package/ios/RnExecutorch/VerticalOCR.mm +0 -183
- package/ios/RnExecutorch/models/BaseModel.h +0 -21
- package/ios/RnExecutorch/models/BaseModel.mm +0 -43
- package/ios/RnExecutorch/models/classification/ClassificationModel.h +0 -10
- package/ios/RnExecutorch/models/classification/ClassificationModel.mm +0 -53
- package/ios/RnExecutorch/models/classification/Constants.h +0 -3
- package/ios/RnExecutorch/models/image_segmentation/Constants.h +0 -4
- package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.h +0 -10
- package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.mm +0 -146
- package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.hpp +0 -11
- package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.mm +0 -64
- package/ios/RnExecutorch/models/ocr/Detector.h +0 -9
- package/ios/RnExecutorch/models/ocr/Detector.mm +0 -101
- package/ios/RnExecutorch/models/ocr/RecognitionHandler.h +0 -16
- package/ios/RnExecutorch/models/ocr/RecognitionHandler.mm +0 -135
- package/ios/RnExecutorch/models/ocr/Recognizer.h +0 -8
- package/ios/RnExecutorch/models/ocr/Recognizer.mm +0 -77
- package/ios/RnExecutorch/models/ocr/VerticalDetector.h +0 -10
- package/ios/RnExecutorch/models/ocr/VerticalDetector.mm +0 -118
- package/ios/RnExecutorch/models/ocr/utils/CTCLabelConverter.h +0 -16
- package/ios/RnExecutorch/models/ocr/utils/CTCLabelConverter.mm +0 -80
- package/ios/RnExecutorch/models/ocr/utils/Constants.h +0 -26
- package/ios/RnExecutorch/models/ocr/utils/DetectorUtils.h +0 -31
- package/ios/RnExecutorch/models/ocr/utils/DetectorUtils.mm +0 -754
- package/ios/RnExecutorch/models/ocr/utils/OCRUtils.h +0 -10
- package/ios/RnExecutorch/models/ocr/utils/OCRUtils.mm +0 -67
- package/ios/RnExecutorch/models/ocr/utils/RecognizerUtils.h +0 -35
- package/ios/RnExecutorch/models/ocr/utils/RecognizerUtils.mm +0 -331
- package/ios/RnExecutorch/models/stt/Moonshine.hpp +0 -13
- package/ios/RnExecutorch/models/stt/Moonshine.mm +0 -64
- package/ios/RnExecutorch/models/stt/MoonshineDecoder.hpp +0 -16
- package/ios/RnExecutorch/models/stt/MoonshineDecoder.mm +0 -24
- package/ios/RnExecutorch/models/stt/MoonshineEncoder.hpp +0 -15
- package/ios/RnExecutorch/models/stt/MoonshineEncoder.mm +0 -18
- package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.hpp +0 -26
- package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.mm +0 -19
- package/ios/RnExecutorch/models/stt/Whisper.hpp +0 -12
- package/ios/RnExecutorch/models/stt/Whisper.mm +0 -68
- package/ios/RnExecutorch/models/stt/WhisperDecoder.hpp +0 -16
- package/ios/RnExecutorch/models/stt/WhisperDecoder.mm +0 -22
- package/ios/RnExecutorch/models/stt/WhisperEncoder.hpp +0 -15
- package/ios/RnExecutorch/models/stt/WhisperEncoder.mm +0 -21
- package/ios/RnExecutorch/models/style_transfer/StyleTransferModel.h +0 -11
- package/ios/RnExecutorch/models/style_transfer/StyleTransferModel.mm +0 -50
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.h +0 -15
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.mm +0 -45
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.h +0 -8
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.mm +0 -49
- package/ios/RnExecutorch/utils/Constants.h +0 -8
- package/ios/RnExecutorch/utils/ObjectDetectionUtils.hpp +0 -23
- package/ios/RnExecutorch/utils/SFFT.hpp +0 -13
- package/ios/RnExecutorch/utils/SFFT.mm +0 -71
- package/lib/module/native/NativeClassification.js +0 -5
- package/lib/module/native/NativeClassification.js.map +0 -1
- package/lib/module/native/NativeETModule.js +0 -5
- package/lib/module/native/NativeETModule.js.map +0 -1
- package/lib/module/native/NativeImageSegmentation.js +0 -5
- package/lib/module/native/NativeImageSegmentation.js.map +0 -1
- package/lib/module/native/NativeOCR.js +0 -5
- package/lib/module/native/NativeOCR.js.map +0 -1
- package/lib/module/native/NativeObjectDetection.js +0 -5
- package/lib/module/native/NativeObjectDetection.js.map +0 -1
- package/lib/module/native/NativeSpeechToText.js +0 -5
- package/lib/module/native/NativeSpeechToText.js.map +0 -1
- package/lib/module/native/NativeStyleTransfer.js +0 -5
- package/lib/module/native/NativeStyleTransfer.js.map +0 -1
- package/lib/module/native/NativeTextEmbeddings.js +0 -5
- package/lib/module/native/NativeTextEmbeddings.js.map +0 -1
- package/lib/module/native/NativeTokenizer.js +0 -5
- package/lib/module/native/NativeTokenizer.js.map +0 -1
- package/lib/module/native/NativeVerticalOCR.js +0 -5
- package/lib/module/native/NativeVerticalOCR.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/typescript/native/NativeClassification.d.ts +0 -10
- package/lib/typescript/native/NativeClassification.d.ts.map +0 -1
- package/lib/typescript/native/NativeETModule.d.ts +0 -9
- package/lib/typescript/native/NativeETModule.d.ts.map +0 -1
- package/lib/typescript/native/NativeImageSegmentation.d.ts +0 -10
- package/lib/typescript/native/NativeImageSegmentation.d.ts.map +0 -1
- package/lib/typescript/native/NativeOCR.d.ts +0 -9
- package/lib/typescript/native/NativeOCR.d.ts.map +0 -1
- package/lib/typescript/native/NativeObjectDetection.d.ts +0 -9
- package/lib/typescript/native/NativeObjectDetection.d.ts.map +0 -1
- package/lib/typescript/native/NativeSpeechToText.d.ts +0 -12
- package/lib/typescript/native/NativeSpeechToText.d.ts.map +0 -1
- package/lib/typescript/native/NativeStyleTransfer.d.ts.map +0 -1
- package/lib/typescript/native/NativeTextEmbeddings.d.ts +0 -8
- package/lib/typescript/native/NativeTextEmbeddings.d.ts.map +0 -1
- package/lib/typescript/native/NativeTokenizer.d.ts +0 -12
- package/lib/typescript/native/NativeTokenizer.d.ts.map +0 -1
- package/lib/typescript/native/NativeVerticalOCR.d.ts +0 -9
- package/lib/typescript/native/NativeVerticalOCR.d.ts.map +0 -1
- package/src/native/NativeClassification.ts +0 -9
- package/src/native/NativeETModule.ts +0 -14
- package/src/native/NativeImageSegmentation.ts +0 -14
- package/src/native/NativeOCR.ts +0 -16
- package/src/native/NativeObjectDetection.ts +0 -10
- package/src/native/NativeSpeechToText.ts +0 -17
- package/src/native/NativeStyleTransfer.ts +0 -10
- package/src/native/NativeTextEmbeddings.ts +0 -9
- package/src/native/NativeTokenizer.ts +0 -13
- package/src/native/NativeVerticalOCR.ts +0 -16
|
@@ -0,0 +1,2753 @@
|
|
|
1
|
+
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
//
|
|
3
|
+
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
4
|
+
//
|
|
5
|
+
// By downloading, copying, installing or using the software you agree to this
|
|
6
|
+
license.
|
|
7
|
+
// If you do not agree to this license, do not download, install,
|
|
8
|
+
// copy or use the software.
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
// License Agreement
|
|
12
|
+
// For Open Source Computer Vision Library
|
|
13
|
+
//
|
|
14
|
+
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
|
15
|
+
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
|
16
|
+
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
|
17
|
+
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
|
18
|
+
// Third party copyrights are property of their respective owners.
|
|
19
|
+
//
|
|
20
|
+
// Redistribution and use in source and binary forms, with or without
|
|
21
|
+
modification,
|
|
22
|
+
// are permitted provided that the following conditions are met:
|
|
23
|
+
//
|
|
24
|
+
// * Redistribution's of source code must retain the above copyright notice,
|
|
25
|
+
// this list of conditions and the following disclaimer.
|
|
26
|
+
//
|
|
27
|
+
// * Redistribution's in binary form must reproduce the above copyright
|
|
28
|
+
notice,
|
|
29
|
+
// this list of conditions and the following disclaimer in the documentation
|
|
30
|
+
// and/or other materials provided with the distribution.
|
|
31
|
+
//
|
|
32
|
+
// * The name of the copyright holders may not be used to endorse or promote
|
|
33
|
+
products
|
|
34
|
+
// derived from this software without specific prior written permission.
|
|
35
|
+
//
|
|
36
|
+
// This software is provided by the copyright holders and contributors "as is"
|
|
37
|
+
and
|
|
38
|
+
// any express or implied warranties, including, but not limited to, the implied
|
|
39
|
+
// warranties of merchantability and fitness for a particular purpose are
|
|
40
|
+
disclaimed.
|
|
41
|
+
// In no event shall the Intel Corporation or contributors be liable for any
|
|
42
|
+
direct,
|
|
43
|
+
// indirect, incidental, special, exemplary, or consequential damages
|
|
44
|
+
// (including, but not limited to, procurement of substitute goods or services;
|
|
45
|
+
// loss of use, data, or profits; or business interruption) however caused
|
|
46
|
+
// and on any theory of liability, whether in contract, strict liability,
|
|
47
|
+
// or tort (including negligence or otherwise) arising in any way out of
|
|
48
|
+
// the use of this software, even if advised of the possibility of such damage.
|
|
49
|
+
//
|
|
50
|
+
//M*/
|
|
51
|
+
|
|
52
|
+
#ifndef OPENCV_CORE_MATRIX_OPERATIONS_HPP
|
|
53
|
+
#define OPENCV_CORE_MATRIX_OPERATIONS_HPP
|
|
54
|
+
|
|
55
|
+
#ifndef __cplusplus
|
|
56
|
+
#error mat.inl.hpp header must be compiled as C++
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#ifdef _MSC_VER
|
|
60
|
+
#pragma warning(push)
|
|
61
|
+
#pragma warning(disable : 4127 5054)
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
#if defined(CV_SKIP_DISABLE_CLANG_ENUM_WARNINGS)
|
|
65
|
+
// nothing
|
|
66
|
+
#elif defined(CV_FORCE_DISABLE_CLANG_ENUM_WARNINGS)
|
|
67
|
+
#define CV_DISABLE_CLANG_ENUM_WARNINGS
|
|
68
|
+
#elif defined(__clang__) && defined(__has_warning)
|
|
69
|
+
#if __has_warning("-Wdeprecated-enum-enum-conversion") && \
|
|
70
|
+
__has_warning("-Wdeprecated-anon-enum-enum-conversion")
|
|
71
|
+
#define CV_DISABLE_CLANG_ENUM_WARNINGS
|
|
72
|
+
#endif
|
|
73
|
+
#endif
|
|
74
|
+
#ifdef CV_DISABLE_CLANG_ENUM_WARNINGS
|
|
75
|
+
#pragma clang diagnostic push
|
|
76
|
+
#pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"
|
|
77
|
+
#pragma clang diagnostic ignored "-Wdeprecated-anon-enum-enum-conversion"
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
namespace cv {
|
|
81
|
+
CV__DEBUG_NS_BEGIN
|
|
82
|
+
|
|
83
|
+
//! @cond IGNORED
|
|
84
|
+
|
|
85
|
+
////////////////////////// Custom (raw) type wrapper //////////////////////////
|
|
86
|
+
|
|
87
|
+
template <typename _Tp> static inline int rawType() {
|
|
88
|
+
CV_StaticAssert(sizeof(_Tp) <= CV_CN_MAX, "sizeof(_Tp) is too large");
|
|
89
|
+
const int elemSize = sizeof(_Tp);
|
|
90
|
+
return (int)CV_MAKETYPE(CV_8U, elemSize);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//////////////////////// Input/Output Arrays ////////////////////////
|
|
94
|
+
|
|
95
|
+
inline void _InputArray::init(int _flags, const void *_obj) {
|
|
96
|
+
flags = _flags;
|
|
97
|
+
obj = (void *)_obj;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
inline void _InputArray::init(int _flags, const void *_obj, Size _sz) {
|
|
101
|
+
flags = _flags;
|
|
102
|
+
obj = (void *)_obj;
|
|
103
|
+
sz = _sz;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
inline void *_InputArray::getObj() const { return obj; }
|
|
107
|
+
inline int _InputArray::getFlags() const { return flags; }
|
|
108
|
+
inline Size _InputArray::getSz() const { return sz; }
|
|
109
|
+
|
|
110
|
+
inline _InputArray::_InputArray() { init(0 + NONE, 0); }
|
|
111
|
+
inline _InputArray::_InputArray(int _flags, void *_obj) { init(_flags, _obj); }
|
|
112
|
+
inline _InputArray::_InputArray(const Mat &m) { init(+MAT + ACCESS_READ, &m); }
|
|
113
|
+
inline _InputArray::_InputArray(const std::vector<Mat> &vec) {
|
|
114
|
+
init(+STD_VECTOR_MAT + ACCESS_READ, &vec);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
template <typename _Tp>
|
|
118
|
+
inline _InputArray::_InputArray(const std::vector<_Tp> &vec) {
|
|
119
|
+
init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_READ, &vec);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
template <typename _Tp, std::size_t _Nm>
|
|
123
|
+
inline _InputArray::_InputArray(const std::array<_Tp, _Nm> &arr) {
|
|
124
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_READ,
|
|
125
|
+
arr.data(), Size(1, _Nm));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
template <std::size_t _Nm>
|
|
129
|
+
inline _InputArray::_InputArray(const std::array<Mat, _Nm> &arr) {
|
|
130
|
+
init(+STD_ARRAY_MAT + ACCESS_READ, arr.data(), Size(1, _Nm));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
inline _InputArray::_InputArray(const std::vector<bool> &vec) {
|
|
134
|
+
init(FIXED_TYPE + STD_BOOL_VECTOR + traits::Type<bool>::value + ACCESS_READ,
|
|
135
|
+
&vec);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
template <typename _Tp>
|
|
139
|
+
inline _InputArray::_InputArray(const std::vector<std::vector<_Tp>> &vec) {
|
|
140
|
+
init(FIXED_TYPE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_READ,
|
|
141
|
+
&vec);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
template <typename _Tp>
|
|
145
|
+
inline _InputArray::_InputArray(const std::vector<Mat_<_Tp>> &vec) {
|
|
146
|
+
init(FIXED_TYPE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_READ,
|
|
147
|
+
&vec);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
template <typename _Tp, int m, int n>
|
|
151
|
+
inline _InputArray::_InputArray(const Matx<_Tp, m, n> &mtx) {
|
|
152
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_READ,
|
|
153
|
+
&mtx, Size(n, m));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
template <typename _Tp> inline _InputArray::_InputArray(const _Tp *vec, int n) {
|
|
157
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_READ,
|
|
158
|
+
vec, Size(n, 1));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
template <typename _Tp> inline _InputArray::_InputArray(const Mat_<_Tp> &m) {
|
|
162
|
+
init(FIXED_TYPE + MAT + traits::Type<_Tp>::value + ACCESS_READ, &m);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
inline _InputArray::_InputArray(const double &val) {
|
|
166
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F + ACCESS_READ, &val, Size(1, 1));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
template <typename _Tp>
|
|
170
|
+
inline _InputArray _InputArray::rawIn(const std::vector<_Tp> &vec) {
|
|
171
|
+
_InputArray v;
|
|
172
|
+
v.flags = _InputArray::FIXED_TYPE + _InputArray::STD_VECTOR + rawType<_Tp>() +
|
|
173
|
+
ACCESS_READ;
|
|
174
|
+
v.obj = (void *)&vec;
|
|
175
|
+
return v;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
template <typename _Tp, std::size_t _Nm>
|
|
179
|
+
inline _InputArray _InputArray::rawIn(const std::array<_Tp, _Nm> &arr) {
|
|
180
|
+
_InputArray v;
|
|
181
|
+
v.flags =
|
|
182
|
+
FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_READ;
|
|
183
|
+
v.obj = (void *)arr.data();
|
|
184
|
+
v.sz = Size(1, _Nm);
|
|
185
|
+
return v;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
inline _InputArray::~_InputArray() {}
|
|
189
|
+
|
|
190
|
+
inline Mat _InputArray::getMat(int i) const {
|
|
191
|
+
if (kind() == MAT && i < 0)
|
|
192
|
+
return *(const Mat *)obj;
|
|
193
|
+
return getMat_(i);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
inline bool _InputArray::isMat() const { return kind() == _InputArray::MAT; }
|
|
197
|
+
inline bool _InputArray::isMatVector() const {
|
|
198
|
+
return kind() == _InputArray::STD_VECTOR_MAT;
|
|
199
|
+
}
|
|
200
|
+
inline bool _InputArray::isMatx() const { return kind() == _InputArray::MATX; }
|
|
201
|
+
inline bool _InputArray::isVector() const {
|
|
202
|
+
return kind() == _InputArray::STD_VECTOR ||
|
|
203
|
+
kind() == _InputArray::STD_BOOL_VECTOR ||
|
|
204
|
+
(kind() == _InputArray::MATX && (sz.width <= 1 || sz.height <= 1));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
////////////////////////////////////////////////////////////////////////////////////////
|
|
208
|
+
|
|
209
|
+
inline _OutputArray::_OutputArray() { init(+NONE + ACCESS_WRITE, 0); }
|
|
210
|
+
inline _OutputArray::_OutputArray(int _flags, void *_obj) {
|
|
211
|
+
init(_flags + ACCESS_WRITE, _obj);
|
|
212
|
+
}
|
|
213
|
+
inline _OutputArray::_OutputArray(Mat &m) { init(+MAT + ACCESS_WRITE, &m); }
|
|
214
|
+
inline _OutputArray::_OutputArray(std::vector<Mat> &vec) {
|
|
215
|
+
init(+STD_VECTOR_MAT + ACCESS_WRITE, &vec);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
template <typename _Tp>
|
|
219
|
+
inline _OutputArray::_OutputArray(std::vector<_Tp> &vec) {
|
|
220
|
+
init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
template <typename _Tp, std::size_t _Nm>
|
|
224
|
+
inline _OutputArray::_OutputArray(std::array<_Tp, _Nm> &arr) {
|
|
225
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
226
|
+
arr.data(), Size(1, _Nm));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
template <std::size_t _Nm>
|
|
230
|
+
inline _OutputArray::_OutputArray(std::array<Mat, _Nm> &arr) {
|
|
231
|
+
init(+STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
template <typename _Tp>
|
|
235
|
+
inline _OutputArray::_OutputArray(std::vector<std::vector<_Tp>> &vec) {
|
|
236
|
+
init(FIXED_TYPE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
237
|
+
&vec);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
template <typename _Tp>
|
|
241
|
+
inline _OutputArray::_OutputArray(std::vector<Mat_<_Tp>> &vec) {
|
|
242
|
+
init(FIXED_TYPE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
243
|
+
&vec);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
template <typename _Tp> inline _OutputArray::_OutputArray(Mat_<_Tp> &m) {
|
|
247
|
+
init(FIXED_TYPE + MAT + traits::Type<_Tp>::value + ACCESS_WRITE, &m);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
template <typename _Tp, int m, int n>
|
|
251
|
+
inline _OutputArray::_OutputArray(Matx<_Tp, m, n> &mtx) {
|
|
252
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
253
|
+
&mtx, Size(n, m));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
template <typename _Tp> inline _OutputArray::_OutputArray(_Tp *vec, int n) {
|
|
257
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
258
|
+
vec, Size(n, 1));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
template <typename _Tp>
|
|
262
|
+
inline _OutputArray::_OutputArray(const std::vector<_Tp> &vec) {
|
|
263
|
+
init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + traits::Type<_Tp>::value +
|
|
264
|
+
ACCESS_WRITE,
|
|
265
|
+
&vec);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
template <typename _Tp, std::size_t _Nm>
|
|
269
|
+
inline _OutputArray::_OutputArray(const std::array<_Tp, _Nm> &arr) {
|
|
270
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
271
|
+
arr.data(), Size(1, _Nm));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
template <std::size_t _Nm>
|
|
275
|
+
inline _OutputArray::_OutputArray(const std::array<Mat, _Nm> &arr) {
|
|
276
|
+
init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
template <typename _Tp>
|
|
280
|
+
inline _OutputArray::_OutputArray(const std::vector<std::vector<_Tp>> &vec) {
|
|
281
|
+
init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value +
|
|
282
|
+
ACCESS_WRITE,
|
|
283
|
+
&vec);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
template <typename _Tp>
|
|
287
|
+
inline _OutputArray::_OutputArray(const std::vector<Mat_<_Tp>> &vec) {
|
|
288
|
+
init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + traits::Type<_Tp>::value +
|
|
289
|
+
ACCESS_WRITE,
|
|
290
|
+
&vec);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
template <typename _Tp> inline _OutputArray::_OutputArray(const Mat_<_Tp> &m) {
|
|
294
|
+
init(FIXED_TYPE + FIXED_SIZE + MAT + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
295
|
+
&m);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
template <typename _Tp, int m, int n>
|
|
299
|
+
inline _OutputArray::_OutputArray(const Matx<_Tp, m, n> &mtx) {
|
|
300
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
301
|
+
&mtx, Size(n, m));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
template <typename _Tp>
|
|
305
|
+
inline _OutputArray::_OutputArray(const _Tp *vec, int n) {
|
|
306
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE,
|
|
307
|
+
vec, Size(n, 1));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
inline _OutputArray::_OutputArray(const Mat &m) {
|
|
311
|
+
init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_WRITE, &m);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
inline _OutputArray::_OutputArray(const std::vector<Mat> &vec) {
|
|
315
|
+
init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_WRITE, &vec);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
template <typename _Tp>
|
|
319
|
+
inline _OutputArray _OutputArray::rawOut(std::vector<_Tp> &vec) {
|
|
320
|
+
_OutputArray v;
|
|
321
|
+
v.flags = _InputArray::FIXED_TYPE + _InputArray::STD_VECTOR + rawType<_Tp>() +
|
|
322
|
+
ACCESS_WRITE;
|
|
323
|
+
v.obj = (void *)&vec;
|
|
324
|
+
return v;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
template <typename _Tp, std::size_t _Nm>
|
|
328
|
+
inline _OutputArray _OutputArray::rawOut(std::array<_Tp, _Nm> &arr) {
|
|
329
|
+
_OutputArray v;
|
|
330
|
+
v.flags =
|
|
331
|
+
FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_WRITE;
|
|
332
|
+
v.obj = (void *)arr.data();
|
|
333
|
+
v.sz = Size(1, _Nm);
|
|
334
|
+
return v;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
///////////////////////////////////////////////////////////////////////////////////////////
|
|
338
|
+
|
|
339
|
+
inline _InputOutputArray::_InputOutputArray() { init(0 + ACCESS_RW, 0); }
|
|
340
|
+
inline _InputOutputArray::_InputOutputArray(int _flags, void *_obj) {
|
|
341
|
+
init(_flags + ACCESS_RW, _obj);
|
|
342
|
+
}
|
|
343
|
+
inline _InputOutputArray::_InputOutputArray(Mat &m) {
|
|
344
|
+
init(+MAT + ACCESS_RW, &m);
|
|
345
|
+
}
|
|
346
|
+
inline _InputOutputArray::_InputOutputArray(std::vector<Mat> &vec) {
|
|
347
|
+
init(+STD_VECTOR_MAT + ACCESS_RW, &vec);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
template <typename _Tp>
|
|
351
|
+
inline _InputOutputArray::_InputOutputArray(std::vector<_Tp> &vec) {
|
|
352
|
+
init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
template <typename _Tp, std::size_t _Nm>
|
|
356
|
+
inline _InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm> &arr) {
|
|
357
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW,
|
|
358
|
+
arr.data(), Size(1, _Nm));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
template <std::size_t _Nm>
|
|
362
|
+
inline _InputOutputArray::_InputOutputArray(std::array<Mat, _Nm> &arr) {
|
|
363
|
+
init(+STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
template <typename _Tp>
|
|
367
|
+
inline _InputOutputArray::_InputOutputArray(
|
|
368
|
+
std::vector<std::vector<_Tp>> &vec) {
|
|
369
|
+
init(FIXED_TYPE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value + ACCESS_RW,
|
|
370
|
+
&vec);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
template <typename _Tp>
|
|
374
|
+
inline _InputOutputArray::_InputOutputArray(std::vector<Mat_<_Tp>> &vec) {
|
|
375
|
+
init(FIXED_TYPE + STD_VECTOR_MAT + traits::Type<_Tp>::value + ACCESS_RW,
|
|
376
|
+
&vec);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
template <typename _Tp>
|
|
380
|
+
inline _InputOutputArray::_InputOutputArray(Mat_<_Tp> &m) {
|
|
381
|
+
init(FIXED_TYPE + MAT + traits::Type<_Tp>::value + ACCESS_RW, &m);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
template <typename _Tp, int m, int n>
|
|
385
|
+
inline _InputOutputArray::_InputOutputArray(Matx<_Tp, m, n> &mtx) {
|
|
386
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW,
|
|
387
|
+
&mtx, Size(n, m));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
template <typename _Tp>
|
|
391
|
+
inline _InputOutputArray::_InputOutputArray(_Tp *vec, int n) {
|
|
392
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW,
|
|
393
|
+
vec, Size(n, 1));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
template <typename _Tp>
|
|
397
|
+
inline _InputOutputArray::_InputOutputArray(const std::vector<_Tp> &vec) {
|
|
398
|
+
init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + traits::Type<_Tp>::value +
|
|
399
|
+
ACCESS_RW,
|
|
400
|
+
&vec);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
template <typename _Tp, std::size_t _Nm>
|
|
404
|
+
inline _InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm> &arr) {
|
|
405
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW,
|
|
406
|
+
arr.data(), Size(1, _Nm));
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
template <std::size_t _Nm>
|
|
410
|
+
inline _InputOutputArray::_InputOutputArray(const std::array<Mat, _Nm> &arr) {
|
|
411
|
+
init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
template <typename _Tp>
|
|
415
|
+
inline _InputOutputArray::_InputOutputArray(
|
|
416
|
+
const std::vector<std::vector<_Tp>> &vec) {
|
|
417
|
+
init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + traits::Type<_Tp>::value +
|
|
418
|
+
ACCESS_RW,
|
|
419
|
+
&vec);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
template <typename _Tp>
|
|
423
|
+
inline _InputOutputArray::_InputOutputArray(const std::vector<Mat_<_Tp>> &vec) {
|
|
424
|
+
init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + traits::Type<_Tp>::value +
|
|
425
|
+
ACCESS_RW,
|
|
426
|
+
&vec);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
template <typename _Tp>
|
|
430
|
+
inline _InputOutputArray::_InputOutputArray(const Mat_<_Tp> &m) {
|
|
431
|
+
init(FIXED_TYPE + FIXED_SIZE + MAT + traits::Type<_Tp>::value + ACCESS_RW,
|
|
432
|
+
&m);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
template <typename _Tp, int m, int n>
|
|
436
|
+
inline _InputOutputArray::_InputOutputArray(const Matx<_Tp, m, n> &mtx) {
|
|
437
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW,
|
|
438
|
+
&mtx, Size(n, m));
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
template <typename _Tp>
|
|
442
|
+
inline _InputOutputArray::_InputOutputArray(const _Tp *vec, int n) {
|
|
443
|
+
init(FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW,
|
|
444
|
+
vec, Size(n, 1));
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
inline _InputOutputArray::_InputOutputArray(const Mat &m) {
|
|
448
|
+
init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_RW, &m);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
inline _InputOutputArray::_InputOutputArray(const std::vector<Mat> &vec) {
|
|
452
|
+
init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_RW, &vec);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
template <typename _Tp>
|
|
456
|
+
inline _InputOutputArray _InputOutputArray::rawInOut(std::vector<_Tp> &vec) {
|
|
457
|
+
_InputOutputArray v;
|
|
458
|
+
v.flags = _InputArray::FIXED_TYPE + _InputArray::STD_VECTOR + rawType<_Tp>() +
|
|
459
|
+
ACCESS_RW;
|
|
460
|
+
v.obj = (void *)&vec;
|
|
461
|
+
return v;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
template <typename _Tp, std::size_t _Nm>
|
|
465
|
+
inline _InputOutputArray
|
|
466
|
+
_InputOutputArray::rawInOut(std::array<_Tp, _Nm> &arr) {
|
|
467
|
+
_InputOutputArray v;
|
|
468
|
+
v.flags =
|
|
469
|
+
FIXED_TYPE + FIXED_SIZE + MATX + traits::Type<_Tp>::value + ACCESS_RW;
|
|
470
|
+
v.obj = (void *)arr.data();
|
|
471
|
+
v.sz = Size(1, _Nm);
|
|
472
|
+
return v;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
template <typename _Tp> static inline _InputArray rawIn(_Tp &v) {
|
|
476
|
+
return _InputArray::rawIn(v);
|
|
477
|
+
}
|
|
478
|
+
template <typename _Tp> static inline _OutputArray rawOut(_Tp &v) {
|
|
479
|
+
return _OutputArray::rawOut(v);
|
|
480
|
+
}
|
|
481
|
+
template <typename _Tp> static inline _InputOutputArray rawInOut(_Tp &v) {
|
|
482
|
+
return _InputOutputArray::rawInOut(v);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
CV__DEBUG_NS_END
|
|
486
|
+
|
|
487
|
+
//////////////////////////////////////////// Mat
|
|
488
|
+
/////////////////////////////////////////////
|
|
489
|
+
|
|
490
|
+
template <typename _Tp>
|
|
491
|
+
inline Mat::Mat(const std::vector<_Tp> &vec, bool copyData)
|
|
492
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2),
|
|
493
|
+
rows((int)vec.size()), cols(1), data(0), datastart(0), dataend(0),
|
|
494
|
+
datalimit(0), allocator(0), u(0), size(&rows), step(0) {
|
|
495
|
+
if (vec.empty())
|
|
496
|
+
return;
|
|
497
|
+
if (!copyData) {
|
|
498
|
+
step[0] = step[1] = sizeof(_Tp);
|
|
499
|
+
datastart = data = (uchar *)&vec[0];
|
|
500
|
+
datalimit = dataend = datastart + rows * step[0];
|
|
501
|
+
} else
|
|
502
|
+
Mat((int)vec.size(), 1, traits::Type<_Tp>::value, (uchar *)&vec[0])
|
|
503
|
+
.copyTo(*this);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
template <typename _Tp, typename>
|
|
507
|
+
inline Mat::Mat(const std::initializer_list<_Tp> list) : Mat() {
|
|
508
|
+
CV_Assert(list.size() != 0);
|
|
509
|
+
Mat((int)list.size(), 1, traits::Type<_Tp>::value, (uchar *)list.begin())
|
|
510
|
+
.copyTo(*this);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
template <typename _Tp>
|
|
514
|
+
inline Mat::Mat(const std::initializer_list<int> sizes,
|
|
515
|
+
const std::initializer_list<_Tp> list)
|
|
516
|
+
: Mat() {
|
|
517
|
+
size_t size_total = 1;
|
|
518
|
+
for (auto s : sizes)
|
|
519
|
+
size_total *= s;
|
|
520
|
+
CV_Assert(list.size() != 0);
|
|
521
|
+
CV_Assert(size_total == list.size());
|
|
522
|
+
Mat((int)sizes.size(), (int *)sizes.begin(), traits::Type<_Tp>::value,
|
|
523
|
+
(uchar *)list.begin())
|
|
524
|
+
.copyTo(*this);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
template <typename _Tp, std::size_t _Nm>
|
|
528
|
+
inline Mat::Mat(const std::array<_Tp, _Nm> &arr, bool copyData)
|
|
529
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2),
|
|
530
|
+
rows((int)arr.size()), cols(1), data(0), datastart(0), dataend(0),
|
|
531
|
+
datalimit(0), allocator(0), u(0), size(&rows), step(0) {
|
|
532
|
+
if (arr.empty())
|
|
533
|
+
return;
|
|
534
|
+
if (!copyData) {
|
|
535
|
+
step[0] = step[1] = sizeof(_Tp);
|
|
536
|
+
datastart = data = (uchar *)arr.data();
|
|
537
|
+
datalimit = dataend = datastart + rows * step[0];
|
|
538
|
+
} else
|
|
539
|
+
Mat((int)arr.size(), 1, traits::Type<_Tp>::value, (uchar *)arr.data())
|
|
540
|
+
.copyTo(*this);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
template <typename _Tp, int n>
|
|
544
|
+
inline Mat::Mat(const Vec<_Tp, n> &vec, bool copyData)
|
|
545
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2),
|
|
546
|
+
rows(n), cols(1), data(0), datastart(0), dataend(0), datalimit(0),
|
|
547
|
+
allocator(0), u(0), size(&rows), step(0) {
|
|
548
|
+
if (!copyData) {
|
|
549
|
+
step[0] = step[1] = sizeof(_Tp);
|
|
550
|
+
datastart = data = (uchar *)vec.val;
|
|
551
|
+
datalimit = dataend = datastart + rows * step[0];
|
|
552
|
+
} else
|
|
553
|
+
Mat(n, 1, traits::Type<_Tp>::value, (void *)vec.val).copyTo(*this);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
template <typename _Tp, int m, int n>
|
|
557
|
+
inline Mat::Mat(const Matx<_Tp, m, n> &M, bool copyData)
|
|
558
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2),
|
|
559
|
+
rows(m), cols(n), data(0), datastart(0), dataend(0), datalimit(0),
|
|
560
|
+
allocator(0), u(0), size(&rows), step(0) {
|
|
561
|
+
if (!copyData) {
|
|
562
|
+
step[0] = cols * sizeof(_Tp);
|
|
563
|
+
step[1] = sizeof(_Tp);
|
|
564
|
+
datastart = data = (uchar *)M.val;
|
|
565
|
+
datalimit = dataend = datastart + rows * step[0];
|
|
566
|
+
} else
|
|
567
|
+
Mat(m, n, traits::Type<_Tp>::value, (uchar *)M.val).copyTo(*this);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
template <typename _Tp>
|
|
571
|
+
inline Mat::Mat(const Point_<_Tp> &pt, bool copyData)
|
|
572
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2),
|
|
573
|
+
rows(2), cols(1), data(0), datastart(0), dataend(0), datalimit(0),
|
|
574
|
+
allocator(0), u(0), size(&rows), step(0) {
|
|
575
|
+
if (!copyData) {
|
|
576
|
+
step[0] = step[1] = sizeof(_Tp);
|
|
577
|
+
datastart = data = (uchar *)&pt.x;
|
|
578
|
+
datalimit = dataend = datastart + rows * step[0];
|
|
579
|
+
} else {
|
|
580
|
+
create(2, 1, traits::Type<_Tp>::value);
|
|
581
|
+
((_Tp *)data)[0] = pt.x;
|
|
582
|
+
((_Tp *)data)[1] = pt.y;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
template <typename _Tp>
|
|
587
|
+
inline Mat::Mat(const Point3_<_Tp> &pt, bool copyData)
|
|
588
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(2),
|
|
589
|
+
rows(3), cols(1), data(0), datastart(0), dataend(0), datalimit(0),
|
|
590
|
+
allocator(0), u(0), size(&rows), step(0) {
|
|
591
|
+
if (!copyData) {
|
|
592
|
+
step[0] = step[1] = sizeof(_Tp);
|
|
593
|
+
datastart = data = (uchar *)&pt.x;
|
|
594
|
+
datalimit = dataend = datastart + rows * step[0];
|
|
595
|
+
} else {
|
|
596
|
+
create(3, 1, traits::Type<_Tp>::value);
|
|
597
|
+
((_Tp *)data)[0] = pt.x;
|
|
598
|
+
((_Tp *)data)[1] = pt.y;
|
|
599
|
+
((_Tp *)data)[2] = pt.z;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
template <typename _Tp>
|
|
604
|
+
inline Mat::Mat(const MatCommaInitializer_<_Tp> &commaInitializer)
|
|
605
|
+
: flags(+MAGIC_VAL + traits::Type<_Tp>::value + CV_MAT_CONT_FLAG), dims(0),
|
|
606
|
+
rows(0), cols(0), data(0), datastart(0), dataend(0), allocator(0), u(0),
|
|
607
|
+
size(&rows) {
|
|
608
|
+
*this = commaInitializer.operator Mat_<_Tp>();
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
inline Mat Mat::row(int y) const {
|
|
612
|
+
return Mat(*this, Range(y, y + 1), Range::all());
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
inline Mat Mat::col(int x) const {
|
|
616
|
+
return Mat(*this, Range::all(), Range(x, x + 1));
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
inline Mat Mat::rowRange(int startrow, int endrow) const {
|
|
620
|
+
return Mat(*this, Range(startrow, endrow), Range::all());
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
inline Mat Mat::rowRange(const Range &r) const {
|
|
624
|
+
return Mat(*this, r, Range::all());
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
inline Mat Mat::colRange(int startcol, int endcol) const {
|
|
628
|
+
return Mat(*this, Range::all(), Range(startcol, endcol));
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
inline Mat Mat::colRange(const Range &r) const {
|
|
632
|
+
return Mat(*this, Range::all(), r);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
inline Mat Mat::operator()(Range _rowRange, Range _colRange) const {
|
|
636
|
+
return Mat(*this, _rowRange, _colRange);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
inline Mat Mat::operator()(const Rect &roi) const { return Mat(*this, roi); }
|
|
640
|
+
|
|
641
|
+
inline Mat Mat::operator()(const Range *ranges) const {
|
|
642
|
+
return Mat(*this, ranges);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
inline Mat Mat::operator()(const std::vector<Range> &ranges) const {
|
|
646
|
+
return Mat(*this, ranges);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
inline bool Mat::isContinuous() const { return (flags & CONTINUOUS_FLAG) != 0; }
|
|
650
|
+
|
|
651
|
+
inline bool Mat::isSubmatrix() const { return (flags & SUBMATRIX_FLAG) != 0; }
|
|
652
|
+
|
|
653
|
+
inline size_t Mat::elemSize() const {
|
|
654
|
+
size_t res = dims > 0 ? step.p[dims - 1] : 0;
|
|
655
|
+
CV_DbgAssert(res != 0);
|
|
656
|
+
return res;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
inline size_t Mat::elemSize1() const { return CV_ELEM_SIZE1(flags); }
|
|
660
|
+
|
|
661
|
+
inline int Mat::type() const { return CV_MAT_TYPE(flags); }
|
|
662
|
+
|
|
663
|
+
inline int Mat::depth() const { return CV_MAT_DEPTH(flags); }
|
|
664
|
+
|
|
665
|
+
inline int Mat::channels() const { return CV_MAT_CN(flags); }
|
|
666
|
+
|
|
667
|
+
inline uchar *Mat::ptr(int y) {
|
|
668
|
+
CV_DbgAssert(y == 0 ||
|
|
669
|
+
(data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]));
|
|
670
|
+
return data + step.p[0] * y;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
inline const uchar *Mat::ptr(int y) const {
|
|
674
|
+
CV_DbgAssert(y == 0 ||
|
|
675
|
+
(data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]));
|
|
676
|
+
return data + step.p[0] * y;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
template <typename _Tp> inline _Tp *Mat::ptr(int y) {
|
|
680
|
+
CV_DbgAssert(y == 0 ||
|
|
681
|
+
(data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]));
|
|
682
|
+
return (_Tp *)(data + step.p[0] * y);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
template <typename _Tp> inline const _Tp *Mat::ptr(int y) const {
|
|
686
|
+
CV_DbgAssert(y == 0 ||
|
|
687
|
+
(data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]));
|
|
688
|
+
return (const _Tp *)(data + step.p[0] * y);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
inline uchar *Mat::ptr(int i0, int i1) {
|
|
692
|
+
CV_DbgAssert(dims >= 2);
|
|
693
|
+
CV_DbgAssert(data);
|
|
694
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
695
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
696
|
+
return data + i0 * step.p[0] + i1 * step.p[1];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
inline const uchar *Mat::ptr(int i0, int i1) const {
|
|
700
|
+
CV_DbgAssert(dims >= 2);
|
|
701
|
+
CV_DbgAssert(data);
|
|
702
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
703
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
704
|
+
return data + i0 * step.p[0] + i1 * step.p[1];
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
template <typename _Tp> inline _Tp *Mat::ptr(int i0, int i1) {
|
|
708
|
+
CV_DbgAssert(dims >= 2);
|
|
709
|
+
CV_DbgAssert(data);
|
|
710
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
711
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
712
|
+
return (_Tp *)(data + i0 * step.p[0] + i1 * step.p[1]);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
template <typename _Tp> inline const _Tp *Mat::ptr(int i0, int i1) const {
|
|
716
|
+
CV_DbgAssert(dims >= 2);
|
|
717
|
+
CV_DbgAssert(data);
|
|
718
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
719
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
720
|
+
return (const _Tp *)(data + i0 * step.p[0] + i1 * step.p[1]);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
inline uchar *Mat::ptr(int i0, int i1, int i2) {
|
|
724
|
+
CV_DbgAssert(dims >= 3);
|
|
725
|
+
CV_DbgAssert(data);
|
|
726
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
727
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
728
|
+
CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
|
|
729
|
+
return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2];
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
inline const uchar *Mat::ptr(int i0, int i1, int i2) const {
|
|
733
|
+
CV_DbgAssert(dims >= 3);
|
|
734
|
+
CV_DbgAssert(data);
|
|
735
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
736
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
737
|
+
CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
|
|
738
|
+
return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2];
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
template <typename _Tp> inline _Tp *Mat::ptr(int i0, int i1, int i2) {
|
|
742
|
+
CV_DbgAssert(dims >= 3);
|
|
743
|
+
CV_DbgAssert(data);
|
|
744
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
745
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
746
|
+
CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
|
|
747
|
+
return (_Tp *)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
template <typename _Tp>
|
|
751
|
+
inline const _Tp *Mat::ptr(int i0, int i1, int i2) const {
|
|
752
|
+
CV_DbgAssert(dims >= 3);
|
|
753
|
+
CV_DbgAssert(data);
|
|
754
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
755
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
756
|
+
CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
|
|
757
|
+
return (const _Tp *)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
inline uchar *Mat::ptr(const int *idx) {
|
|
761
|
+
int i, d = dims;
|
|
762
|
+
uchar *p = data;
|
|
763
|
+
CV_DbgAssert(d >= 1 && p);
|
|
764
|
+
for (i = 0; i < d; i++) {
|
|
765
|
+
CV_DbgAssert((unsigned)idx[i] < (unsigned)size.p[i]);
|
|
766
|
+
p += idx[i] * step.p[i];
|
|
767
|
+
}
|
|
768
|
+
return p;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
inline const uchar *Mat::ptr(const int *idx) const {
|
|
772
|
+
int i, d = dims;
|
|
773
|
+
uchar *p = data;
|
|
774
|
+
CV_DbgAssert(d >= 1 && p);
|
|
775
|
+
for (i = 0; i < d; i++) {
|
|
776
|
+
CV_DbgAssert((unsigned)idx[i] < (unsigned)size.p[i]);
|
|
777
|
+
p += idx[i] * step.p[i];
|
|
778
|
+
}
|
|
779
|
+
return p;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
template <typename _Tp> inline _Tp *Mat::ptr(const int *idx) {
|
|
783
|
+
int i, d = dims;
|
|
784
|
+
uchar *p = data;
|
|
785
|
+
CV_DbgAssert(d >= 1 && p);
|
|
786
|
+
for (i = 0; i < d; i++) {
|
|
787
|
+
CV_DbgAssert((unsigned)idx[i] < (unsigned)size.p[i]);
|
|
788
|
+
p += idx[i] * step.p[i];
|
|
789
|
+
}
|
|
790
|
+
return (_Tp *)p;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
template <typename _Tp> inline const _Tp *Mat::ptr(const int *idx) const {
|
|
794
|
+
int i, d = dims;
|
|
795
|
+
uchar *p = data;
|
|
796
|
+
CV_DbgAssert(d >= 1 && p);
|
|
797
|
+
for (i = 0; i < d; i++) {
|
|
798
|
+
CV_DbgAssert((unsigned)idx[i] < (unsigned)size.p[i]);
|
|
799
|
+
p += idx[i] * step.p[i];
|
|
800
|
+
}
|
|
801
|
+
return (const _Tp *)p;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
template <int n> inline uchar *Mat::ptr(const Vec<int, n> &idx) {
|
|
805
|
+
return Mat::ptr(idx.val);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
template <int n> inline const uchar *Mat::ptr(const Vec<int, n> &idx) const {
|
|
809
|
+
return Mat::ptr(idx.val);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
template <typename _Tp, int n> inline _Tp *Mat::ptr(const Vec<int, n> &idx) {
|
|
813
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
814
|
+
return Mat::ptr<_Tp>(idx.val);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
template <typename _Tp, int n>
|
|
818
|
+
inline const _Tp *Mat::ptr(const Vec<int, n> &idx) const {
|
|
819
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
820
|
+
return Mat::ptr<_Tp>(idx.val);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
template <typename _Tp> inline _Tp &Mat::at(int i0, int i1) {
|
|
824
|
+
CV_DbgAssert(dims <= 2);
|
|
825
|
+
CV_DbgAssert(data);
|
|
826
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
827
|
+
CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) <
|
|
828
|
+
(unsigned)(size.p[1] * channels()));
|
|
829
|
+
CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1());
|
|
830
|
+
return ((_Tp *)(data + step.p[0] * i0))[i1];
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
template <typename _Tp> inline const _Tp &Mat::at(int i0, int i1) const {
|
|
834
|
+
CV_DbgAssert(dims <= 2);
|
|
835
|
+
CV_DbgAssert(data);
|
|
836
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
837
|
+
CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) <
|
|
838
|
+
(unsigned)(size.p[1] * channels()));
|
|
839
|
+
CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1());
|
|
840
|
+
return ((const _Tp *)(data + step.p[0] * i0))[i1];
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
template <typename _Tp> inline _Tp &Mat::at(Point pt) {
|
|
844
|
+
CV_DbgAssert(dims <= 2);
|
|
845
|
+
CV_DbgAssert(data);
|
|
846
|
+
CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
|
|
847
|
+
CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) <
|
|
848
|
+
(unsigned)(size.p[1] * channels()));
|
|
849
|
+
CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1());
|
|
850
|
+
return ((_Tp *)(data + step.p[0] * pt.y))[pt.x];
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
template <typename _Tp> inline const _Tp &Mat::at(Point pt) const {
|
|
854
|
+
CV_DbgAssert(dims <= 2);
|
|
855
|
+
CV_DbgAssert(data);
|
|
856
|
+
CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
|
|
857
|
+
CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) <
|
|
858
|
+
(unsigned)(size.p[1] * channels()));
|
|
859
|
+
CV_DbgAssert(CV_ELEM_SIZE1(traits::Depth<_Tp>::value) == elemSize1());
|
|
860
|
+
return ((const _Tp *)(data + step.p[0] * pt.y))[pt.x];
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
template <typename _Tp> inline _Tp &Mat::at(int i0) {
|
|
864
|
+
CV_DbgAssert(dims <= 2);
|
|
865
|
+
CV_DbgAssert(data);
|
|
866
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]));
|
|
867
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
868
|
+
if (isContinuous() || size.p[0] == 1)
|
|
869
|
+
return ((_Tp *)data)[i0];
|
|
870
|
+
if (size.p[1] == 1)
|
|
871
|
+
return *(_Tp *)(data + step.p[0] * i0);
|
|
872
|
+
int i = i0 / cols, j = i0 - i * cols;
|
|
873
|
+
return ((_Tp *)(data + step.p[0] * i))[j];
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
template <typename _Tp> inline const _Tp &Mat::at(int i0) const {
|
|
877
|
+
CV_DbgAssert(dims <= 2);
|
|
878
|
+
CV_DbgAssert(data);
|
|
879
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]));
|
|
880
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
881
|
+
if (isContinuous() || size.p[0] == 1)
|
|
882
|
+
return ((const _Tp *)data)[i0];
|
|
883
|
+
if (size.p[1] == 1)
|
|
884
|
+
return *(const _Tp *)(data + step.p[0] * i0);
|
|
885
|
+
int i = i0 / cols, j = i0 - i * cols;
|
|
886
|
+
return ((const _Tp *)(data + step.p[0] * i))[j];
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
template <typename _Tp> inline _Tp &Mat::at(int i0, int i1, int i2) {
|
|
890
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
891
|
+
return *(_Tp *)ptr(i0, i1, i2);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
template <typename _Tp>
|
|
895
|
+
inline const _Tp &Mat::at(int i0, int i1, int i2) const {
|
|
896
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
897
|
+
return *(const _Tp *)ptr(i0, i1, i2);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
template <typename _Tp> inline _Tp &Mat::at(const int *idx) {
|
|
901
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
902
|
+
return *(_Tp *)ptr(idx);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
template <typename _Tp> inline const _Tp &Mat::at(const int *idx) const {
|
|
906
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
907
|
+
return *(const _Tp *)ptr(idx);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
template <typename _Tp, int n> inline _Tp &Mat::at(const Vec<int, n> &idx) {
|
|
911
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
912
|
+
return *(_Tp *)ptr(idx.val);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
template <typename _Tp, int n>
|
|
916
|
+
inline const _Tp &Mat::at(const Vec<int, n> &idx) const {
|
|
917
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
918
|
+
return *(const _Tp *)ptr(idx.val);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
template <typename _Tp> inline MatConstIterator_<_Tp> Mat::begin() const {
|
|
922
|
+
if (empty())
|
|
923
|
+
return MatConstIterator_<_Tp>();
|
|
924
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
925
|
+
return MatConstIterator_<_Tp>((const Mat_<_Tp> *)this);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
template <typename _Tp>
|
|
929
|
+
inline std::reverse_iterator<MatConstIterator_<_Tp>> Mat::rbegin() const {
|
|
930
|
+
if (empty())
|
|
931
|
+
return std::reverse_iterator<MatConstIterator_<_Tp>>();
|
|
932
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
933
|
+
MatConstIterator_<_Tp> it((const Mat_<_Tp> *)this);
|
|
934
|
+
it += total();
|
|
935
|
+
return std::reverse_iterator<MatConstIterator_<_Tp>>(it);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
template <typename _Tp> inline MatConstIterator_<_Tp> Mat::end() const {
|
|
939
|
+
if (empty())
|
|
940
|
+
return MatConstIterator_<_Tp>();
|
|
941
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
942
|
+
MatConstIterator_<_Tp> it((const Mat_<_Tp> *)this);
|
|
943
|
+
it += total();
|
|
944
|
+
return it;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
template <typename _Tp>
|
|
948
|
+
inline std::reverse_iterator<MatConstIterator_<_Tp>> Mat::rend() const {
|
|
949
|
+
if (empty())
|
|
950
|
+
return std::reverse_iterator<MatConstIterator_<_Tp>>();
|
|
951
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
952
|
+
return std::reverse_iterator<MatConstIterator_<_Tp>>((const Mat_<_Tp> *)this);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
template <typename _Tp> inline MatIterator_<_Tp> Mat::begin() {
|
|
956
|
+
if (empty())
|
|
957
|
+
return MatIterator_<_Tp>();
|
|
958
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
959
|
+
return MatIterator_<_Tp>((Mat_<_Tp> *)this);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
template <typename _Tp>
|
|
963
|
+
inline std::reverse_iterator<MatIterator_<_Tp>> Mat::rbegin() {
|
|
964
|
+
if (empty())
|
|
965
|
+
return std::reverse_iterator<MatIterator_<_Tp>>();
|
|
966
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
967
|
+
MatIterator_<_Tp> it((Mat_<_Tp> *)this);
|
|
968
|
+
it += total();
|
|
969
|
+
return std::reverse_iterator<MatIterator_<_Tp>>(it);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
template <typename _Tp> inline MatIterator_<_Tp> Mat::end() {
|
|
973
|
+
if (empty())
|
|
974
|
+
return MatIterator_<_Tp>();
|
|
975
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
976
|
+
MatIterator_<_Tp> it((Mat_<_Tp> *)this);
|
|
977
|
+
it += total();
|
|
978
|
+
return it;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
template <typename _Tp>
|
|
982
|
+
inline std::reverse_iterator<MatIterator_<_Tp>> Mat::rend() {
|
|
983
|
+
if (empty())
|
|
984
|
+
return std::reverse_iterator<MatIterator_<_Tp>>();
|
|
985
|
+
CV_DbgAssert(elemSize() == sizeof(_Tp));
|
|
986
|
+
return std::reverse_iterator<MatIterator_<_Tp>>(
|
|
987
|
+
MatIterator_<_Tp>((Mat_<_Tp> *)this));
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
template <typename _Tp, typename Functor>
|
|
991
|
+
inline void Mat::forEach(const Functor &operation) {
|
|
992
|
+
this->forEach_impl<_Tp>(operation);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
template <typename _Tp, typename Functor>
|
|
996
|
+
inline void Mat::forEach(const Functor &operation) const {
|
|
997
|
+
// call as not const
|
|
998
|
+
(const_cast<Mat *>(this))->forEach<_Tp>(operation);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
template <typename _Tp> inline Mat::operator std::vector<_Tp>() const {
|
|
1002
|
+
std::vector<_Tp> v;
|
|
1003
|
+
copyTo(v);
|
|
1004
|
+
return v;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
template <typename _Tp, std::size_t _Nm>
|
|
1008
|
+
inline Mat::operator std::array<_Tp, _Nm>() const {
|
|
1009
|
+
std::array<_Tp, _Nm> v;
|
|
1010
|
+
copyTo(v);
|
|
1011
|
+
return v;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
template <typename _Tp, int n> inline Mat::operator Vec<_Tp, n>() const {
|
|
1015
|
+
CV_Assert(data && dims <= 2 && (rows == 1 || cols == 1) &&
|
|
1016
|
+
rows + cols - 1 == n && channels() == 1);
|
|
1017
|
+
|
|
1018
|
+
if (isContinuous() && type() == traits::Type<_Tp>::value)
|
|
1019
|
+
return Vec<_Tp, n>((_Tp *)data);
|
|
1020
|
+
Vec<_Tp, n> v;
|
|
1021
|
+
Mat tmp(rows, cols, traits::Type<_Tp>::value, v.val);
|
|
1022
|
+
convertTo(tmp, tmp.type());
|
|
1023
|
+
return v;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
template <typename _Tp, int m, int n>
|
|
1027
|
+
inline Mat::operator Matx<_Tp, m, n>() const {
|
|
1028
|
+
CV_Assert(data && dims <= 2 && rows == m && cols == n && channels() == 1);
|
|
1029
|
+
|
|
1030
|
+
if (isContinuous() && type() == traits::Type<_Tp>::value)
|
|
1031
|
+
return Matx<_Tp, m, n>((_Tp *)data);
|
|
1032
|
+
Matx<_Tp, m, n> mtx;
|
|
1033
|
+
Mat tmp(rows, cols, traits::Type<_Tp>::value, mtx.val);
|
|
1034
|
+
convertTo(tmp, tmp.type());
|
|
1035
|
+
return mtx;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
template <typename _Tp> inline void Mat::push_back(const _Tp &elem) {
|
|
1039
|
+
if (!data) {
|
|
1040
|
+
*this = Mat(1, 1, traits::Type<_Tp>::value, (void *)&elem).clone();
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
CV_Assert(traits::Type<_Tp>::value == type() && cols == 1
|
|
1044
|
+
/* && dims == 2 (cols == 1 implies dims == 2) */);
|
|
1045
|
+
const uchar *tmp = dataend + step[0];
|
|
1046
|
+
if (!isSubmatrix() && isContinuous() && tmp <= datalimit) {
|
|
1047
|
+
*(_Tp *)(data + (size.p[0]++) * step.p[0]) = elem;
|
|
1048
|
+
dataend = tmp;
|
|
1049
|
+
} else
|
|
1050
|
+
push_back_(&elem);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
template <typename _Tp> inline void Mat::push_back(const Mat_<_Tp> &m) {
|
|
1054
|
+
push_back((const Mat &)m);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
template <> inline void Mat::push_back(const MatExpr &expr) {
|
|
1058
|
+
push_back(static_cast<Mat>(expr));
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
template <typename _Tp> inline void Mat::push_back(const std::vector<_Tp> &v) {
|
|
1062
|
+
push_back(Mat(v));
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
///////////////////////////// MatSize ////////////////////////////
|
|
1066
|
+
|
|
1067
|
+
inline MatSize::MatSize(int *_p) CV_NOEXCEPT : p(_p) {}
|
|
1068
|
+
|
|
1069
|
+
inline int MatSize::dims() const CV_NOEXCEPT { return (p - 1)[0]; }
|
|
1070
|
+
|
|
1071
|
+
inline Size MatSize::operator()() const {
|
|
1072
|
+
CV_DbgAssert(dims() <= 2);
|
|
1073
|
+
return Size(p[1], p[0]);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
inline const int &MatSize::operator[](int i) const {
|
|
1077
|
+
CV_DbgAssert(i < dims());
|
|
1078
|
+
#ifdef __OPENCV_BUILD
|
|
1079
|
+
CV_DbgAssert(i >= 0);
|
|
1080
|
+
#endif
|
|
1081
|
+
return p[i];
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
inline int &MatSize::operator[](int i) {
|
|
1085
|
+
CV_DbgAssert(i < dims());
|
|
1086
|
+
#ifdef __OPENCV_BUILD
|
|
1087
|
+
CV_DbgAssert(i >= 0);
|
|
1088
|
+
#endif
|
|
1089
|
+
return p[i];
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
inline MatSize::operator const int *() const CV_NOEXCEPT { return p; }
|
|
1093
|
+
|
|
1094
|
+
inline bool MatSize::operator!=(const MatSize &sz) const CV_NOEXCEPT {
|
|
1095
|
+
return !(*this == sz);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
///////////////////////////// MatStep ////////////////////////////
|
|
1099
|
+
|
|
1100
|
+
inline MatStep::MatStep() CV_NOEXCEPT {
|
|
1101
|
+
p = buf;
|
|
1102
|
+
p[0] = p[1] = 0;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
inline MatStep::MatStep(size_t s) CV_NOEXCEPT {
|
|
1106
|
+
p = buf;
|
|
1107
|
+
p[0] = s;
|
|
1108
|
+
p[1] = 0;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
inline const size_t &MatStep::operator[](int i) const CV_NOEXCEPT {
|
|
1112
|
+
return p[i];
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
inline size_t &MatStep::operator[](int i) CV_NOEXCEPT { return p[i]; }
|
|
1116
|
+
|
|
1117
|
+
inline MatStep::operator size_t() const {
|
|
1118
|
+
CV_DbgAssert(p == buf);
|
|
1119
|
+
return buf[0];
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
inline MatStep &MatStep::operator=(size_t s) {
|
|
1123
|
+
CV_DbgAssert(p == buf);
|
|
1124
|
+
buf[0] = s;
|
|
1125
|
+
return *this;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
////////////////////////////// Mat_<_Tp> ////////////////////////////
|
|
1129
|
+
|
|
1130
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_() CV_NOEXCEPT : Mat() {
|
|
1131
|
+
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
template <typename _Tp>
|
|
1135
|
+
inline Mat_<_Tp>::Mat_(int _rows, int _cols)
|
|
1136
|
+
: Mat(_rows, _cols, traits::Type<_Tp>::value) {}
|
|
1137
|
+
|
|
1138
|
+
template <typename _Tp>
|
|
1139
|
+
inline Mat_<_Tp>::Mat_(int _rows, int _cols, const _Tp &value)
|
|
1140
|
+
: Mat(_rows, _cols, traits::Type<_Tp>::value) {
|
|
1141
|
+
*this = value;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
template <typename _Tp>
|
|
1145
|
+
inline Mat_<_Tp>::Mat_(Size _sz)
|
|
1146
|
+
: Mat(_sz.height, _sz.width, traits::Type<_Tp>::value) {}
|
|
1147
|
+
|
|
1148
|
+
template <typename _Tp>
|
|
1149
|
+
inline Mat_<_Tp>::Mat_(Size _sz, const _Tp &value)
|
|
1150
|
+
: Mat(_sz.height, _sz.width, traits::Type<_Tp>::value) {
|
|
1151
|
+
*this = value;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
template <typename _Tp>
|
|
1155
|
+
inline Mat_<_Tp>::Mat_(int _dims, const int *_sz)
|
|
1156
|
+
: Mat(_dims, _sz, traits::Type<_Tp>::value) {}
|
|
1157
|
+
|
|
1158
|
+
template <typename _Tp>
|
|
1159
|
+
inline Mat_<_Tp>::Mat_(int _dims, const int *_sz, const _Tp &_s)
|
|
1160
|
+
: Mat(_dims, _sz, traits::Type<_Tp>::value, Scalar(_s)) {}
|
|
1161
|
+
|
|
1162
|
+
template <typename _Tp>
|
|
1163
|
+
inline Mat_<_Tp>::Mat_(int _dims, const int *_sz, _Tp *_data,
|
|
1164
|
+
const size_t *_steps)
|
|
1165
|
+
: Mat(_dims, _sz, traits::Type<_Tp>::value, _data, _steps) {}
|
|
1166
|
+
|
|
1167
|
+
template <typename _Tp>
|
|
1168
|
+
inline Mat_<_Tp>::Mat_(const Mat_<_Tp> &m, const Range *ranges)
|
|
1169
|
+
: Mat(m, ranges) {}
|
|
1170
|
+
|
|
1171
|
+
template <typename _Tp>
|
|
1172
|
+
inline Mat_<_Tp>::Mat_(const Mat_<_Tp> &m, const std::vector<Range> &ranges)
|
|
1173
|
+
: Mat(m, ranges) {}
|
|
1174
|
+
|
|
1175
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_(const Mat &m) : Mat() {
|
|
1176
|
+
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;
|
|
1177
|
+
*this = m;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_(const Mat_ &m) : Mat(m) {}
|
|
1181
|
+
|
|
1182
|
+
template <typename _Tp>
|
|
1183
|
+
inline Mat_<_Tp>::Mat_(int _rows, int _cols, _Tp *_data, size_t steps)
|
|
1184
|
+
: Mat(_rows, _cols, traits::Type<_Tp>::value, _data, steps) {}
|
|
1185
|
+
|
|
1186
|
+
template <typename _Tp>
|
|
1187
|
+
inline Mat_<_Tp>::Mat_(const Mat_ &m, const Range &_rowRange,
|
|
1188
|
+
const Range &_colRange)
|
|
1189
|
+
: Mat(m, _rowRange, _colRange) {}
|
|
1190
|
+
|
|
1191
|
+
template <typename _Tp>
|
|
1192
|
+
inline Mat_<_Tp>::Mat_(const Mat_ &m, const Rect &roi) : Mat(m, roi) {}
|
|
1193
|
+
|
|
1194
|
+
template <typename _Tp>
|
|
1195
|
+
template <int n>
|
|
1196
|
+
inline Mat_<_Tp>::Mat_(const Vec<typename DataType<_Tp>::channel_type, n> &vec,
|
|
1197
|
+
bool copyData)
|
|
1198
|
+
: Mat(n / DataType<_Tp>::channels, 1, traits::Type<_Tp>::value,
|
|
1199
|
+
(void *)&vec) {
|
|
1200
|
+
CV_Assert(n % DataType<_Tp>::channels == 0);
|
|
1201
|
+
if (copyData)
|
|
1202
|
+
*this = clone();
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
template <typename _Tp>
|
|
1206
|
+
template <int m, int n>
|
|
1207
|
+
inline Mat_<_Tp>::Mat_(
|
|
1208
|
+
const Matx<typename DataType<_Tp>::channel_type, m, n> &M, bool copyData)
|
|
1209
|
+
: Mat(m, n / DataType<_Tp>::channels, traits::Type<_Tp>::value,
|
|
1210
|
+
(void *)&M) {
|
|
1211
|
+
CV_Assert(n % DataType<_Tp>::channels == 0);
|
|
1212
|
+
if (copyData)
|
|
1213
|
+
*this = clone();
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
template <typename _Tp>
|
|
1217
|
+
inline Mat_<_Tp>::Mat_(const Point_<typename DataType<_Tp>::channel_type> &pt,
|
|
1218
|
+
bool copyData)
|
|
1219
|
+
: Mat(2 / DataType<_Tp>::channels, 1, traits::Type<_Tp>::value,
|
|
1220
|
+
(void *)&pt) {
|
|
1221
|
+
CV_Assert(2 % DataType<_Tp>::channels == 0);
|
|
1222
|
+
if (copyData)
|
|
1223
|
+
*this = clone();
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
template <typename _Tp>
|
|
1227
|
+
inline Mat_<_Tp>::Mat_(const Point3_<typename DataType<_Tp>::channel_type> &pt,
|
|
1228
|
+
bool copyData)
|
|
1229
|
+
: Mat(3 / DataType<_Tp>::channels, 1, traits::Type<_Tp>::value,
|
|
1230
|
+
(void *)&pt) {
|
|
1231
|
+
CV_Assert(3 % DataType<_Tp>::channels == 0);
|
|
1232
|
+
if (copyData)
|
|
1233
|
+
*this = clone();
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
template <typename _Tp>
|
|
1237
|
+
inline Mat_<_Tp>::Mat_(const MatCommaInitializer_<_Tp> &commaInitializer)
|
|
1238
|
+
: Mat(commaInitializer) {}
|
|
1239
|
+
|
|
1240
|
+
template <typename _Tp>
|
|
1241
|
+
inline Mat_<_Tp>::Mat_(const std::vector<_Tp> &vec, bool copyData)
|
|
1242
|
+
: Mat(vec, copyData) {}
|
|
1243
|
+
|
|
1244
|
+
template <typename _Tp>
|
|
1245
|
+
inline Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list) : Mat(list) {}
|
|
1246
|
+
|
|
1247
|
+
template <typename _Tp>
|
|
1248
|
+
inline Mat_<_Tp>::Mat_(const std::initializer_list<int> sizes,
|
|
1249
|
+
std::initializer_list<_Tp> list)
|
|
1250
|
+
: Mat(sizes, list) {}
|
|
1251
|
+
|
|
1252
|
+
template <typename _Tp>
|
|
1253
|
+
template <std::size_t _Nm>
|
|
1254
|
+
inline Mat_<_Tp>::Mat_(const std::array<_Tp, _Nm> &arr, bool copyData)
|
|
1255
|
+
: Mat(arr, copyData) {}
|
|
1256
|
+
|
|
1257
|
+
template <typename _Tp> inline Mat_<_Tp> &Mat_<_Tp>::operator=(const Mat &m) {
|
|
1258
|
+
if (m.empty()) {
|
|
1259
|
+
release();
|
|
1260
|
+
return *this;
|
|
1261
|
+
}
|
|
1262
|
+
if (traits::Type<_Tp>::value == m.type()) {
|
|
1263
|
+
Mat::operator=(m);
|
|
1264
|
+
return *this;
|
|
1265
|
+
}
|
|
1266
|
+
if (traits::Depth<_Tp>::value == m.depth()) {
|
|
1267
|
+
return (*this = m.reshape(DataType<_Tp>::channels, m.dims, 0));
|
|
1268
|
+
}
|
|
1269
|
+
CV_Assert(DataType<_Tp>::channels == m.channels() || m.empty());
|
|
1270
|
+
m.convertTo(*this, type());
|
|
1271
|
+
return *this;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
template <typename _Tp> inline Mat_<_Tp> &Mat_<_Tp>::operator=(const Mat_ &m) {
|
|
1275
|
+
Mat::operator=(m);
|
|
1276
|
+
return *this;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
template <typename _Tp> inline Mat_<_Tp> &Mat_<_Tp>::operator=(const _Tp &s) {
|
|
1280
|
+
typedef typename DataType<_Tp>::vec_type VT;
|
|
1281
|
+
Mat::operator=(Scalar((const VT &)s));
|
|
1282
|
+
return *this;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
template <typename _Tp> inline void Mat_<_Tp>::create(int _rows, int _cols) {
|
|
1286
|
+
Mat::create(_rows, _cols, traits::Type<_Tp>::value);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
template <typename _Tp> inline void Mat_<_Tp>::create(Size _sz) {
|
|
1290
|
+
Mat::create(_sz, traits::Type<_Tp>::value);
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
template <typename _Tp>
|
|
1294
|
+
inline void Mat_<_Tp>::create(int _dims, const int *_sz) {
|
|
1295
|
+
Mat::create(_dims, _sz, traits::Type<_Tp>::value);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
template <typename _Tp> inline void Mat_<_Tp>::release() {
|
|
1299
|
+
Mat::release();
|
|
1300
|
+
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
template <typename _Tp> inline Mat_<_Tp> Mat_<_Tp>::cross(const Mat_ &m) const {
|
|
1304
|
+
return Mat_<_Tp>(Mat::cross(m));
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
template <typename _Tp>
|
|
1308
|
+
template <typename T2>
|
|
1309
|
+
inline Mat_<_Tp>::operator Mat_<T2>() const {
|
|
1310
|
+
return Mat_<T2>(static_cast<const Mat &>(*this));
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
template <typename _Tp> inline Mat_<_Tp> Mat_<_Tp>::row(int y) const {
|
|
1314
|
+
return Mat_(*this, Range(y, y + 1), Range::all());
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
template <typename _Tp> inline Mat_<_Tp> Mat_<_Tp>::col(int x) const {
|
|
1318
|
+
return Mat_(*this, Range::all(), Range(x, x + 1));
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
template <typename _Tp> inline Mat_<_Tp> Mat_<_Tp>::diag(int d) const {
|
|
1322
|
+
return Mat_(Mat::diag(d));
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
template <typename _Tp> inline Mat_<_Tp> Mat_<_Tp>::clone() const {
|
|
1326
|
+
return Mat_(Mat::clone());
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
template <typename _Tp> inline size_t Mat_<_Tp>::elemSize() const {
|
|
1330
|
+
CV_DbgAssert(Mat::elemSize() == sizeof(_Tp));
|
|
1331
|
+
return sizeof(_Tp);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
template <typename _Tp> inline size_t Mat_<_Tp>::elemSize1() const {
|
|
1335
|
+
CV_DbgAssert(Mat::elemSize1() == sizeof(_Tp) / DataType<_Tp>::channels);
|
|
1336
|
+
return sizeof(_Tp) / DataType<_Tp>::channels;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
template <typename _Tp> inline int Mat_<_Tp>::type() const {
|
|
1340
|
+
CV_DbgAssert(Mat::type() == traits::Type<_Tp>::value);
|
|
1341
|
+
return traits::Type<_Tp>::value;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
template <typename _Tp> inline int Mat_<_Tp>::depth() const {
|
|
1345
|
+
CV_DbgAssert(Mat::depth() == traits::Depth<_Tp>::value);
|
|
1346
|
+
return traits::Depth<_Tp>::value;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
template <typename _Tp> inline int Mat_<_Tp>::channels() const {
|
|
1350
|
+
CV_DbgAssert(Mat::channels() == DataType<_Tp>::channels);
|
|
1351
|
+
return DataType<_Tp>::channels;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
template <typename _Tp> inline size_t Mat_<_Tp>::stepT(int i) const {
|
|
1355
|
+
return step.p[i] / elemSize();
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
template <typename _Tp> inline size_t Mat_<_Tp>::step1(int i) const {
|
|
1359
|
+
return step.p[i] / elemSize1();
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
template <typename _Tp>
|
|
1363
|
+
inline Mat_<_Tp> &Mat_<_Tp>::adjustROI(int dtop, int dbottom, int dleft,
|
|
1364
|
+
int dright) {
|
|
1365
|
+
return (Mat_<_Tp> &)(Mat::adjustROI(dtop, dbottom, dleft, dright));
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
template <typename _Tp>
|
|
1369
|
+
inline Mat_<_Tp> Mat_<_Tp>::operator()(const Range &_rowRange,
|
|
1370
|
+
const Range &_colRange) const {
|
|
1371
|
+
return Mat_<_Tp>(*this, _rowRange, _colRange);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
template <typename _Tp>
|
|
1375
|
+
inline Mat_<_Tp> Mat_<_Tp>::operator()(const Rect &roi) const {
|
|
1376
|
+
return Mat_<_Tp>(*this, roi);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
template <typename _Tp>
|
|
1380
|
+
inline Mat_<_Tp> Mat_<_Tp>::operator()(const Range *ranges) const {
|
|
1381
|
+
return Mat_<_Tp>(*this, ranges);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
template <typename _Tp>
|
|
1385
|
+
inline Mat_<_Tp> Mat_<_Tp>::operator()(const std::vector<Range> &ranges) const {
|
|
1386
|
+
return Mat_<_Tp>(*this, ranges);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
template <typename _Tp> inline _Tp *Mat_<_Tp>::operator[](int y) {
|
|
1390
|
+
CV_DbgAssert(0 <= y && y < size.p[0]);
|
|
1391
|
+
return (_Tp *)(data + y * step.p[0]);
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
template <typename _Tp> inline const _Tp *Mat_<_Tp>::operator[](int y) const {
|
|
1395
|
+
CV_DbgAssert(0 <= y && y < size.p[0]);
|
|
1396
|
+
return (const _Tp *)(data + y * step.p[0]);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
template <typename _Tp> inline _Tp &Mat_<_Tp>::operator()(int i0, int i1) {
|
|
1400
|
+
CV_DbgAssert(dims <= 2);
|
|
1401
|
+
CV_DbgAssert(data);
|
|
1402
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
1403
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
1404
|
+
CV_DbgAssert(type() == traits::Type<_Tp>::value);
|
|
1405
|
+
return ((_Tp *)(data + step.p[0] * i0))[i1];
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
template <typename _Tp>
|
|
1409
|
+
inline const _Tp &Mat_<_Tp>::operator()(int i0, int i1) const {
|
|
1410
|
+
CV_DbgAssert(dims <= 2);
|
|
1411
|
+
CV_DbgAssert(data);
|
|
1412
|
+
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
|
|
1413
|
+
CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
|
|
1414
|
+
CV_DbgAssert(type() == traits::Type<_Tp>::value);
|
|
1415
|
+
return ((const _Tp *)(data + step.p[0] * i0))[i1];
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
template <typename _Tp> inline _Tp &Mat_<_Tp>::operator()(Point pt) {
|
|
1419
|
+
CV_DbgAssert(dims <= 2);
|
|
1420
|
+
CV_DbgAssert(data);
|
|
1421
|
+
CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
|
|
1422
|
+
CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]);
|
|
1423
|
+
CV_DbgAssert(type() == traits::Type<_Tp>::value);
|
|
1424
|
+
return ((_Tp *)(data + step.p[0] * pt.y))[pt.x];
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
template <typename _Tp>
|
|
1428
|
+
inline const _Tp &Mat_<_Tp>::operator()(Point pt) const {
|
|
1429
|
+
CV_DbgAssert(dims <= 2);
|
|
1430
|
+
CV_DbgAssert(data);
|
|
1431
|
+
CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
|
|
1432
|
+
CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]);
|
|
1433
|
+
CV_DbgAssert(type() == traits::Type<_Tp>::value);
|
|
1434
|
+
return ((const _Tp *)(data + step.p[0] * pt.y))[pt.x];
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
template <typename _Tp> inline _Tp &Mat_<_Tp>::operator()(const int *idx) {
|
|
1438
|
+
return Mat::at<_Tp>(idx);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
template <typename _Tp>
|
|
1442
|
+
inline const _Tp &Mat_<_Tp>::operator()(const int *idx) const {
|
|
1443
|
+
return Mat::at<_Tp>(idx);
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
template <typename _Tp>
|
|
1447
|
+
template <int n>
|
|
1448
|
+
inline _Tp &Mat_<_Tp>::operator()(const Vec<int, n> &idx) {
|
|
1449
|
+
return Mat::at<_Tp>(idx);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
template <typename _Tp>
|
|
1453
|
+
template <int n>
|
|
1454
|
+
inline const _Tp &Mat_<_Tp>::operator()(const Vec<int, n> &idx) const {
|
|
1455
|
+
return Mat::at<_Tp>(idx);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
template <typename _Tp> inline _Tp &Mat_<_Tp>::operator()(int i0) {
|
|
1459
|
+
return this->at<_Tp>(i0);
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
template <typename _Tp> inline const _Tp &Mat_<_Tp>::operator()(int i0) const {
|
|
1463
|
+
return this->at<_Tp>(i0);
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
template <typename _Tp>
|
|
1467
|
+
inline _Tp &Mat_<_Tp>::operator()(int i0, int i1, int i2) {
|
|
1468
|
+
return this->at<_Tp>(i0, i1, i2);
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
template <typename _Tp>
|
|
1472
|
+
inline const _Tp &Mat_<_Tp>::operator()(int i0, int i1, int i2) const {
|
|
1473
|
+
return this->at<_Tp>(i0, i1, i2);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
template <typename _Tp> inline Mat_<_Tp>::operator std::vector<_Tp>() const {
|
|
1477
|
+
std::vector<_Tp> v;
|
|
1478
|
+
copyTo(v);
|
|
1479
|
+
return v;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
template <typename _Tp>
|
|
1483
|
+
template <std::size_t _Nm>
|
|
1484
|
+
inline Mat_<_Tp>::operator std::array<_Tp, _Nm>() const {
|
|
1485
|
+
std::array<_Tp, _Nm> a;
|
|
1486
|
+
copyTo(a);
|
|
1487
|
+
return a;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
template <typename _Tp>
|
|
1491
|
+
template <int n>
|
|
1492
|
+
inline Mat_<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>()
|
|
1493
|
+
const {
|
|
1494
|
+
CV_Assert(n % DataType<_Tp>::channels == 0);
|
|
1495
|
+
|
|
1496
|
+
#if defined _MSC_VER
|
|
1497
|
+
const Mat *pMat =
|
|
1498
|
+
(const Mat *)this; // workaround for MSVS <= 2012 compiler bugs (but
|
|
1499
|
+
// GCC 4.6 dislikes this workaround)
|
|
1500
|
+
return pMat->operator Vec<typename DataType<_Tp>::channel_type, n>();
|
|
1501
|
+
#else
|
|
1502
|
+
return this->Mat::operator Vec<typename DataType<_Tp>::channel_type, n>();
|
|
1503
|
+
#endif
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
template <typename _Tp>
|
|
1507
|
+
template <int m, int n>
|
|
1508
|
+
inline Mat_<_Tp>::operator Matx<typename DataType<_Tp>::channel_type, m, n>()
|
|
1509
|
+
const {
|
|
1510
|
+
CV_Assert(n % DataType<_Tp>::channels == 0);
|
|
1511
|
+
|
|
1512
|
+
#if defined _MSC_VER
|
|
1513
|
+
const Mat *pMat =
|
|
1514
|
+
(const Mat *)this; // workaround for MSVS <= 2012 compiler bugs (but
|
|
1515
|
+
// GCC 4.6 dislikes this workaround)
|
|
1516
|
+
Matx<typename DataType<_Tp>::channel_type, m, n> res =
|
|
1517
|
+
pMat->operator Matx<typename DataType<_Tp>::channel_type, m, n>();
|
|
1518
|
+
return res;
|
|
1519
|
+
#else
|
|
1520
|
+
Matx<typename DataType<_Tp>::channel_type, m, n> res =
|
|
1521
|
+
this->Mat::operator Matx<typename DataType<_Tp>::channel_type, m, n>();
|
|
1522
|
+
return res;
|
|
1523
|
+
#endif
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
template <typename _Tp> inline MatConstIterator_<_Tp> Mat_<_Tp>::begin() const {
|
|
1527
|
+
return Mat::begin<_Tp>();
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
template <typename _Tp>
|
|
1531
|
+
inline std::reverse_iterator<MatConstIterator_<_Tp>> Mat_<_Tp>::rbegin() const {
|
|
1532
|
+
return Mat::rbegin<_Tp>();
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
template <typename _Tp> inline MatConstIterator_<_Tp> Mat_<_Tp>::end() const {
|
|
1536
|
+
return Mat::end<_Tp>();
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
template <typename _Tp>
|
|
1540
|
+
inline std::reverse_iterator<MatConstIterator_<_Tp>> Mat_<_Tp>::rend() const {
|
|
1541
|
+
return Mat::rend<_Tp>();
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
template <typename _Tp> inline MatIterator_<_Tp> Mat_<_Tp>::begin() {
|
|
1545
|
+
return Mat::begin<_Tp>();
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
template <typename _Tp>
|
|
1549
|
+
inline std::reverse_iterator<MatIterator_<_Tp>> Mat_<_Tp>::rbegin() {
|
|
1550
|
+
return Mat::rbegin<_Tp>();
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
template <typename _Tp> inline MatIterator_<_Tp> Mat_<_Tp>::end() {
|
|
1554
|
+
return Mat::end<_Tp>();
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
template <typename _Tp>
|
|
1558
|
+
inline std::reverse_iterator<MatIterator_<_Tp>> Mat_<_Tp>::rend() {
|
|
1559
|
+
return Mat::rend<_Tp>();
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
template <typename _Tp>
|
|
1563
|
+
template <typename Functor>
|
|
1564
|
+
inline void Mat_<_Tp>::forEach(const Functor &operation) {
|
|
1565
|
+
Mat::forEach<_Tp, Functor>(operation);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
template <typename _Tp>
|
|
1569
|
+
template <typename Functor>
|
|
1570
|
+
inline void Mat_<_Tp>::forEach(const Functor &operation) const {
|
|
1571
|
+
Mat::forEach<_Tp, Functor>(operation);
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_(Mat_ &&m) : Mat(std::move(m)) {}
|
|
1575
|
+
|
|
1576
|
+
template <typename _Tp> inline Mat_<_Tp> &Mat_<_Tp>::operator=(Mat_ &&m) {
|
|
1577
|
+
Mat::operator=(std::move(m));
|
|
1578
|
+
return *this;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_(Mat &&m) : Mat() {
|
|
1582
|
+
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;
|
|
1583
|
+
*this = std::move(m);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
template <typename _Tp> inline Mat_<_Tp> &Mat_<_Tp>::operator=(Mat &&m) {
|
|
1587
|
+
if (m.empty()) {
|
|
1588
|
+
release();
|
|
1589
|
+
return *this;
|
|
1590
|
+
}
|
|
1591
|
+
if (traits::Type<_Tp>::value == m.type()) {
|
|
1592
|
+
Mat::operator=((Mat &&)m);
|
|
1593
|
+
return *this;
|
|
1594
|
+
}
|
|
1595
|
+
if (traits::Depth<_Tp>::value == m.depth()) {
|
|
1596
|
+
Mat::operator=((Mat &&)m.reshape(DataType<_Tp>::channels, m.dims, 0));
|
|
1597
|
+
return *this;
|
|
1598
|
+
}
|
|
1599
|
+
CV_DbgAssert(DataType<_Tp>::channels == m.channels());
|
|
1600
|
+
m.convertTo(*this, type());
|
|
1601
|
+
return *this;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_(MatExpr &&e) : Mat() {
|
|
1605
|
+
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;
|
|
1606
|
+
*this = Mat(e);
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
///////////////////////////// SparseMat /////////////////////////////
|
|
1610
|
+
|
|
1611
|
+
inline SparseMat SparseMat::clone() const {
|
|
1612
|
+
SparseMat temp;
|
|
1613
|
+
this->copyTo(temp);
|
|
1614
|
+
return temp;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
inline size_t SparseMat::elemSize() const { return CV_ELEM_SIZE(flags); }
|
|
1618
|
+
|
|
1619
|
+
inline size_t SparseMat::elemSize1() const { return CV_ELEM_SIZE1(flags); }
|
|
1620
|
+
|
|
1621
|
+
inline int SparseMat::type() const { return CV_MAT_TYPE(flags); }
|
|
1622
|
+
|
|
1623
|
+
inline int SparseMat::depth() const { return CV_MAT_DEPTH(flags); }
|
|
1624
|
+
|
|
1625
|
+
inline int SparseMat::channels() const { return CV_MAT_CN(flags); }
|
|
1626
|
+
|
|
1627
|
+
inline const int *SparseMat::size() const { return hdr ? hdr->size : 0; }
|
|
1628
|
+
|
|
1629
|
+
inline int SparseMat::size(int i) const {
|
|
1630
|
+
if (hdr) {
|
|
1631
|
+
CV_DbgAssert((unsigned)i < (unsigned)hdr->dims);
|
|
1632
|
+
return hdr->size[i];
|
|
1633
|
+
}
|
|
1634
|
+
return 0;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
inline int SparseMat::dims() const { return hdr ? hdr->dims : 0; }
|
|
1638
|
+
|
|
1639
|
+
inline size_t SparseMat::nzcount() const { return hdr ? hdr->nodeCount : 0; }
|
|
1640
|
+
|
|
1641
|
+
template <typename _Tp> inline _Tp &SparseMat::ref(int i0, size_t *hashval) {
|
|
1642
|
+
return *(_Tp *)((SparseMat *)this)->ptr(i0, true, hashval);
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
template <typename _Tp>
|
|
1646
|
+
inline _Tp &SparseMat::ref(int i0, int i1, size_t *hashval) {
|
|
1647
|
+
return *(_Tp *)((SparseMat *)this)->ptr(i0, i1, true, hashval);
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
template <typename _Tp>
|
|
1651
|
+
inline _Tp &SparseMat::ref(int i0, int i1, int i2, size_t *hashval) {
|
|
1652
|
+
return *(_Tp *)((SparseMat *)this)->ptr(i0, i1, i2, true, hashval);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
template <typename _Tp>
|
|
1656
|
+
inline _Tp &SparseMat::ref(const int *idx, size_t *hashval) {
|
|
1657
|
+
return *(_Tp *)((SparseMat *)this)->ptr(idx, true, hashval);
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
template <typename _Tp>
|
|
1661
|
+
inline _Tp SparseMat::value(int i0, size_t *hashval) const {
|
|
1662
|
+
const _Tp *p = (const _Tp *)((SparseMat *)this)->ptr(i0, false, hashval);
|
|
1663
|
+
return p ? *p : _Tp();
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
template <typename _Tp>
|
|
1667
|
+
inline _Tp SparseMat::value(int i0, int i1, size_t *hashval) const {
|
|
1668
|
+
const _Tp *p = (const _Tp *)((SparseMat *)this)->ptr(i0, i1, false, hashval);
|
|
1669
|
+
return p ? *p : _Tp();
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
template <typename _Tp>
|
|
1673
|
+
inline _Tp SparseMat::value(int i0, int i1, int i2, size_t *hashval) const {
|
|
1674
|
+
const _Tp *p =
|
|
1675
|
+
(const _Tp *)((SparseMat *)this)->ptr(i0, i1, i2, false, hashval);
|
|
1676
|
+
return p ? *p : _Tp();
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
template <typename _Tp>
|
|
1680
|
+
inline _Tp SparseMat::value(const int *idx, size_t *hashval) const {
|
|
1681
|
+
const _Tp *p = (const _Tp *)((SparseMat *)this)->ptr(idx, false, hashval);
|
|
1682
|
+
return p ? *p : _Tp();
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
template <typename _Tp>
|
|
1686
|
+
inline const _Tp *SparseMat::find(int i0, size_t *hashval) const {
|
|
1687
|
+
return (const _Tp *)((SparseMat *)this)->ptr(i0, false, hashval);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
template <typename _Tp>
|
|
1691
|
+
inline const _Tp *SparseMat::find(int i0, int i1, size_t *hashval) const {
|
|
1692
|
+
return (const _Tp *)((SparseMat *)this)->ptr(i0, i1, false, hashval);
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
template <typename _Tp>
|
|
1696
|
+
inline const _Tp *SparseMat::find(int i0, int i1, int i2,
|
|
1697
|
+
size_t *hashval) const {
|
|
1698
|
+
return (const _Tp *)((SparseMat *)this)->ptr(i0, i1, i2, false, hashval);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
template <typename _Tp>
|
|
1702
|
+
inline const _Tp *SparseMat::find(const int *idx, size_t *hashval) const {
|
|
1703
|
+
return (const _Tp *)((SparseMat *)this)->ptr(idx, false, hashval);
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
template <typename _Tp> inline _Tp &SparseMat::value(Node *n) {
|
|
1707
|
+
return *(_Tp *)((uchar *)n + hdr->valueOffset);
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
template <typename _Tp>
|
|
1711
|
+
inline const _Tp &SparseMat::value(const Node *n) const {
|
|
1712
|
+
return *(const _Tp *)((const uchar *)n + hdr->valueOffset);
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
inline SparseMat::Node *SparseMat::node(size_t nidx) {
|
|
1716
|
+
return (Node *)(void *)&hdr->pool[nidx];
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
inline const SparseMat::Node *SparseMat::node(size_t nidx) const {
|
|
1720
|
+
return (const Node *)(const void *)&hdr->pool[nidx];
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
inline SparseMatIterator SparseMat::begin() { return SparseMatIterator(this); }
|
|
1724
|
+
|
|
1725
|
+
inline SparseMatConstIterator SparseMat::begin() const {
|
|
1726
|
+
return SparseMatConstIterator(this);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
inline SparseMatIterator SparseMat::end() {
|
|
1730
|
+
SparseMatIterator it(this);
|
|
1731
|
+
it.seekEnd();
|
|
1732
|
+
return it;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
inline SparseMatConstIterator SparseMat::end() const {
|
|
1736
|
+
SparseMatConstIterator it(this);
|
|
1737
|
+
it.seekEnd();
|
|
1738
|
+
return it;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
template <typename _Tp> inline SparseMatIterator_<_Tp> SparseMat::begin() {
|
|
1742
|
+
return SparseMatIterator_<_Tp>(this);
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
template <typename _Tp>
|
|
1746
|
+
inline SparseMatConstIterator_<_Tp> SparseMat::begin() const {
|
|
1747
|
+
return SparseMatConstIterator_<_Tp>(this);
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
template <typename _Tp> inline SparseMatIterator_<_Tp> SparseMat::end() {
|
|
1751
|
+
SparseMatIterator_<_Tp> it(this);
|
|
1752
|
+
it.seekEnd();
|
|
1753
|
+
return it;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
template <typename _Tp>
|
|
1757
|
+
inline SparseMatConstIterator_<_Tp> SparseMat::end() const {
|
|
1758
|
+
SparseMatConstIterator_<_Tp> it(this);
|
|
1759
|
+
it.seekEnd();
|
|
1760
|
+
return it;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
///////////////////////////// SparseMat_ ////////////////////////////
|
|
1764
|
+
|
|
1765
|
+
template <typename _Tp> inline SparseMat_<_Tp>::SparseMat_() {
|
|
1766
|
+
flags = +MAGIC_VAL + traits::Type<_Tp>::value;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
template <typename _Tp>
|
|
1770
|
+
inline SparseMat_<_Tp>::SparseMat_(int _dims, const int *_sizes)
|
|
1771
|
+
: SparseMat(_dims, _sizes, traits::Type<_Tp>::value) {}
|
|
1772
|
+
|
|
1773
|
+
template <typename _Tp> inline SparseMat_<_Tp>::SparseMat_(const SparseMat &m) {
|
|
1774
|
+
if (m.type() == traits::Type<_Tp>::value)
|
|
1775
|
+
*this = (const SparseMat_<_Tp> &)m;
|
|
1776
|
+
else
|
|
1777
|
+
m.convertTo(*this, traits::Type<_Tp>::value);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
template <typename _Tp>
|
|
1781
|
+
inline SparseMat_<_Tp>::SparseMat_(const SparseMat_<_Tp> &m) {
|
|
1782
|
+
this->flags = m.flags;
|
|
1783
|
+
this->hdr = m.hdr;
|
|
1784
|
+
if (this->hdr)
|
|
1785
|
+
CV_XADD(&this->hdr->refcount, 1);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
template <typename _Tp> inline SparseMat_<_Tp>::SparseMat_(const Mat &m) {
|
|
1789
|
+
SparseMat sm(m);
|
|
1790
|
+
*this = sm;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
template <typename _Tp>
|
|
1794
|
+
inline SparseMat_<_Tp> &SparseMat_<_Tp>::operator=(const SparseMat_<_Tp> &m) {
|
|
1795
|
+
if (this != &m) {
|
|
1796
|
+
if (m.hdr)
|
|
1797
|
+
CV_XADD(&m.hdr->refcount, 1);
|
|
1798
|
+
release();
|
|
1799
|
+
flags = m.flags;
|
|
1800
|
+
hdr = m.hdr;
|
|
1801
|
+
}
|
|
1802
|
+
return *this;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
template <typename _Tp>
|
|
1806
|
+
inline SparseMat_<_Tp> &SparseMat_<_Tp>::operator=(const SparseMat &m) {
|
|
1807
|
+
if (m.type() == traits::Type<_Tp>::value)
|
|
1808
|
+
return (*this = (const SparseMat_<_Tp> &)m);
|
|
1809
|
+
m.convertTo(*this, traits::Type<_Tp>::value);
|
|
1810
|
+
return *this;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
template <typename _Tp>
|
|
1814
|
+
inline SparseMat_<_Tp> &SparseMat_<_Tp>::operator=(const Mat &m) {
|
|
1815
|
+
return (*this = SparseMat(m));
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
template <typename _Tp> inline SparseMat_<_Tp> SparseMat_<_Tp>::clone() const {
|
|
1819
|
+
SparseMat_<_Tp> m;
|
|
1820
|
+
this->copyTo(m);
|
|
1821
|
+
return m;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
template <typename _Tp>
|
|
1825
|
+
inline void SparseMat_<_Tp>::create(int _dims, const int *_sizes) {
|
|
1826
|
+
SparseMat::create(_dims, _sizes, traits::Type<_Tp>::value);
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
template <typename _Tp> inline int SparseMat_<_Tp>::type() const {
|
|
1830
|
+
return traits::Type<_Tp>::value;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
template <typename _Tp> inline int SparseMat_<_Tp>::depth() const {
|
|
1834
|
+
return traits::Depth<_Tp>::value;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
template <typename _Tp> inline int SparseMat_<_Tp>::channels() const {
|
|
1838
|
+
return DataType<_Tp>::channels;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
template <typename _Tp>
|
|
1842
|
+
inline _Tp &SparseMat_<_Tp>::ref(int i0, size_t *hashval) {
|
|
1843
|
+
return SparseMat::ref<_Tp>(i0, hashval);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
template <typename _Tp>
|
|
1847
|
+
inline _Tp SparseMat_<_Tp>::operator()(int i0, size_t *hashval) const {
|
|
1848
|
+
return SparseMat::value<_Tp>(i0, hashval);
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
template <typename _Tp>
|
|
1852
|
+
inline _Tp &SparseMat_<_Tp>::ref(int i0, int i1, size_t *hashval) {
|
|
1853
|
+
return SparseMat::ref<_Tp>(i0, i1, hashval);
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
template <typename _Tp>
|
|
1857
|
+
inline _Tp SparseMat_<_Tp>::operator()(int i0, int i1, size_t *hashval) const {
|
|
1858
|
+
return SparseMat::value<_Tp>(i0, i1, hashval);
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
template <typename _Tp>
|
|
1862
|
+
inline _Tp &SparseMat_<_Tp>::ref(int i0, int i1, int i2, size_t *hashval) {
|
|
1863
|
+
return SparseMat::ref<_Tp>(i0, i1, i2, hashval);
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
template <typename _Tp>
|
|
1867
|
+
inline _Tp SparseMat_<_Tp>::operator()(int i0, int i1, int i2,
|
|
1868
|
+
size_t *hashval) const {
|
|
1869
|
+
return SparseMat::value<_Tp>(i0, i1, i2, hashval);
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
template <typename _Tp>
|
|
1873
|
+
inline _Tp &SparseMat_<_Tp>::ref(const int *idx, size_t *hashval) {
|
|
1874
|
+
return SparseMat::ref<_Tp>(idx, hashval);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
template <typename _Tp>
|
|
1878
|
+
inline _Tp SparseMat_<_Tp>::operator()(const int *idx, size_t *hashval) const {
|
|
1879
|
+
return SparseMat::value<_Tp>(idx, hashval);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
template <typename _Tp>
|
|
1883
|
+
inline SparseMatIterator_<_Tp> SparseMat_<_Tp>::begin() {
|
|
1884
|
+
return SparseMatIterator_<_Tp>(this);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
template <typename _Tp>
|
|
1888
|
+
inline SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::begin() const {
|
|
1889
|
+
return SparseMatConstIterator_<_Tp>(this);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
template <typename _Tp> inline SparseMatIterator_<_Tp> SparseMat_<_Tp>::end() {
|
|
1893
|
+
SparseMatIterator_<_Tp> it(this);
|
|
1894
|
+
it.seekEnd();
|
|
1895
|
+
return it;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
template <typename _Tp>
|
|
1899
|
+
inline SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::end() const {
|
|
1900
|
+
SparseMatConstIterator_<_Tp> it(this);
|
|
1901
|
+
it.seekEnd();
|
|
1902
|
+
return it;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
////////////////////////// MatConstIterator /////////////////////////
|
|
1906
|
+
|
|
1907
|
+
inline MatConstIterator::MatConstIterator()
|
|
1908
|
+
: m(0), elemSize(0), ptr(0), sliceStart(0), sliceEnd(0) {}
|
|
1909
|
+
|
|
1910
|
+
inline MatConstIterator::MatConstIterator(const Mat *_m)
|
|
1911
|
+
: m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0) {
|
|
1912
|
+
if (m && m->isContinuous()) {
|
|
1913
|
+
CV_Assert(!m->empty());
|
|
1914
|
+
sliceStart = m->ptr();
|
|
1915
|
+
sliceEnd = sliceStart + m->total() * elemSize;
|
|
1916
|
+
}
|
|
1917
|
+
seek((const int *)0);
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
inline MatConstIterator::MatConstIterator(const Mat *_m, int _row, int _col)
|
|
1921
|
+
: m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0) {
|
|
1922
|
+
CV_Assert(m && m->dims <= 2);
|
|
1923
|
+
if (m->isContinuous()) {
|
|
1924
|
+
CV_Assert(!m->empty());
|
|
1925
|
+
sliceStart = m->ptr();
|
|
1926
|
+
sliceEnd = sliceStart + m->total() * elemSize;
|
|
1927
|
+
}
|
|
1928
|
+
int idx[] = {_row, _col};
|
|
1929
|
+
seek(idx);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
inline MatConstIterator::MatConstIterator(const Mat *_m, Point _pt)
|
|
1933
|
+
: m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0) {
|
|
1934
|
+
CV_Assert(m && m->dims <= 2);
|
|
1935
|
+
if (m->isContinuous()) {
|
|
1936
|
+
CV_Assert(!m->empty());
|
|
1937
|
+
sliceStart = m->ptr();
|
|
1938
|
+
sliceEnd = sliceStart + m->total() * elemSize;
|
|
1939
|
+
}
|
|
1940
|
+
int idx[] = {_pt.y, _pt.x};
|
|
1941
|
+
seek(idx);
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
inline MatConstIterator::MatConstIterator(const MatConstIterator &it)
|
|
1945
|
+
: m(it.m), elemSize(it.elemSize), ptr(it.ptr), sliceStart(it.sliceStart),
|
|
1946
|
+
sliceEnd(it.sliceEnd) {}
|
|
1947
|
+
|
|
1948
|
+
inline MatConstIterator &
|
|
1949
|
+
MatConstIterator::operator=(const MatConstIterator &it) {
|
|
1950
|
+
m = it.m;
|
|
1951
|
+
elemSize = it.elemSize;
|
|
1952
|
+
ptr = it.ptr;
|
|
1953
|
+
sliceStart = it.sliceStart;
|
|
1954
|
+
sliceEnd = it.sliceEnd;
|
|
1955
|
+
return *this;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
inline const uchar *MatConstIterator::operator*() const { return ptr; }
|
|
1959
|
+
|
|
1960
|
+
inline MatConstIterator &MatConstIterator::operator+=(ptrdiff_t ofs) {
|
|
1961
|
+
if (!m || ofs == 0)
|
|
1962
|
+
return *this;
|
|
1963
|
+
ptrdiff_t ofsb = ofs * elemSize;
|
|
1964
|
+
ptr += ofsb;
|
|
1965
|
+
if (ptr < sliceStart || sliceEnd <= ptr) {
|
|
1966
|
+
ptr -= ofsb;
|
|
1967
|
+
seek(ofs, true);
|
|
1968
|
+
}
|
|
1969
|
+
return *this;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
inline MatConstIterator &MatConstIterator::operator-=(ptrdiff_t ofs) {
|
|
1973
|
+
return (*this += -ofs);
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
inline MatConstIterator &MatConstIterator::operator--() {
|
|
1977
|
+
if (m && (ptr -= elemSize) < sliceStart) {
|
|
1978
|
+
ptr += elemSize;
|
|
1979
|
+
seek(-1, true);
|
|
1980
|
+
}
|
|
1981
|
+
return *this;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
inline MatConstIterator MatConstIterator::operator--(int) {
|
|
1985
|
+
MatConstIterator b = *this;
|
|
1986
|
+
*this += -1;
|
|
1987
|
+
return b;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
inline MatConstIterator &MatConstIterator::operator++() {
|
|
1991
|
+
if (m && (ptr += elemSize) >= sliceEnd) {
|
|
1992
|
+
ptr -= elemSize;
|
|
1993
|
+
seek(1, true);
|
|
1994
|
+
}
|
|
1995
|
+
return *this;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
inline MatConstIterator MatConstIterator::operator++(int) {
|
|
1999
|
+
MatConstIterator b = *this;
|
|
2000
|
+
*this += 1;
|
|
2001
|
+
return b;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
static inline bool operator==(const MatConstIterator &a,
|
|
2005
|
+
const MatConstIterator &b) {
|
|
2006
|
+
return a.m == b.m && a.ptr == b.ptr;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
static inline bool operator!=(const MatConstIterator &a,
|
|
2010
|
+
const MatConstIterator &b) {
|
|
2011
|
+
return !(a == b);
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
static inline bool operator<(const MatConstIterator &a,
|
|
2015
|
+
const MatConstIterator &b) {
|
|
2016
|
+
return a.ptr < b.ptr;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
static inline bool operator>(const MatConstIterator &a,
|
|
2020
|
+
const MatConstIterator &b) {
|
|
2021
|
+
return a.ptr > b.ptr;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
static inline bool operator<=(const MatConstIterator &a,
|
|
2025
|
+
const MatConstIterator &b) {
|
|
2026
|
+
return a.ptr <= b.ptr;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
static inline bool operator>=(const MatConstIterator &a,
|
|
2030
|
+
const MatConstIterator &b) {
|
|
2031
|
+
return a.ptr >= b.ptr;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
static inline ptrdiff_t operator-(const MatConstIterator &b,
|
|
2035
|
+
const MatConstIterator &a) {
|
|
2036
|
+
if (a.m != b.m)
|
|
2037
|
+
return ((size_t)(-1) >> 1);
|
|
2038
|
+
if (a.sliceEnd == b.sliceEnd)
|
|
2039
|
+
return (b.ptr - a.ptr) / static_cast<ptrdiff_t>(b.elemSize);
|
|
2040
|
+
|
|
2041
|
+
return b.lpos() - a.lpos();
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
static inline MatConstIterator operator+(const MatConstIterator &a,
|
|
2045
|
+
ptrdiff_t ofs) {
|
|
2046
|
+
MatConstIterator b = a;
|
|
2047
|
+
return b += ofs;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
static inline MatConstIterator operator+(ptrdiff_t ofs,
|
|
2051
|
+
const MatConstIterator &a) {
|
|
2052
|
+
MatConstIterator b = a;
|
|
2053
|
+
return b += ofs;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
static inline MatConstIterator operator-(const MatConstIterator &a,
|
|
2057
|
+
ptrdiff_t ofs) {
|
|
2058
|
+
MatConstIterator b = a;
|
|
2059
|
+
return b += -ofs;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
inline const uchar *MatConstIterator::operator[](ptrdiff_t i) const {
|
|
2063
|
+
return *(*this + i);
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
///////////////////////// MatConstIterator_ /////////////////////////
|
|
2067
|
+
|
|
2068
|
+
template <typename _Tp> inline MatConstIterator_<_Tp>::MatConstIterator_() {}
|
|
2069
|
+
|
|
2070
|
+
template <typename _Tp>
|
|
2071
|
+
inline MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp> *_m)
|
|
2072
|
+
: MatConstIterator(_m) {}
|
|
2073
|
+
|
|
2074
|
+
template <typename _Tp>
|
|
2075
|
+
inline MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp> *_m, int _row,
|
|
2076
|
+
int _col)
|
|
2077
|
+
: MatConstIterator(_m, _row, _col) {}
|
|
2078
|
+
|
|
2079
|
+
template <typename _Tp>
|
|
2080
|
+
inline MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp> *_m, Point _pt)
|
|
2081
|
+
: MatConstIterator(_m, _pt) {}
|
|
2082
|
+
|
|
2083
|
+
template <typename _Tp>
|
|
2084
|
+
inline MatConstIterator_<_Tp>::MatConstIterator_(const MatConstIterator_ &it)
|
|
2085
|
+
: MatConstIterator(it) {}
|
|
2086
|
+
|
|
2087
|
+
template <typename _Tp>
|
|
2088
|
+
inline MatConstIterator_<_Tp> &
|
|
2089
|
+
MatConstIterator_<_Tp>::operator=(const MatConstIterator_ &it) {
|
|
2090
|
+
MatConstIterator::operator=(it);
|
|
2091
|
+
return *this;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
template <typename _Tp>
|
|
2095
|
+
inline const _Tp &MatConstIterator_<_Tp>::operator*() const {
|
|
2096
|
+
return *(_Tp *)(this->ptr);
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
template <typename _Tp>
|
|
2100
|
+
inline MatConstIterator_<_Tp> &
|
|
2101
|
+
MatConstIterator_<_Tp>::operator+=(ptrdiff_t ofs) {
|
|
2102
|
+
MatConstIterator::operator+=(ofs);
|
|
2103
|
+
return *this;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
template <typename _Tp>
|
|
2107
|
+
inline MatConstIterator_<_Tp> &
|
|
2108
|
+
MatConstIterator_<_Tp>::operator-=(ptrdiff_t ofs) {
|
|
2109
|
+
return (*this += -ofs);
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
template <typename _Tp>
|
|
2113
|
+
inline MatConstIterator_<_Tp> &MatConstIterator_<_Tp>::operator--() {
|
|
2114
|
+
MatConstIterator::operator--();
|
|
2115
|
+
return *this;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
template <typename _Tp>
|
|
2119
|
+
inline MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator--(int) {
|
|
2120
|
+
MatConstIterator_ b = *this;
|
|
2121
|
+
MatConstIterator::operator--();
|
|
2122
|
+
return b;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
template <typename _Tp>
|
|
2126
|
+
inline MatConstIterator_<_Tp> &MatConstIterator_<_Tp>::operator++() {
|
|
2127
|
+
MatConstIterator::operator++();
|
|
2128
|
+
return *this;
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
template <typename _Tp>
|
|
2132
|
+
inline MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator++(int) {
|
|
2133
|
+
MatConstIterator_ b = *this;
|
|
2134
|
+
MatConstIterator::operator++();
|
|
2135
|
+
return b;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
template <typename _Tp> inline Point MatConstIterator_<_Tp>::pos() const {
|
|
2139
|
+
if (!m)
|
|
2140
|
+
return Point();
|
|
2141
|
+
CV_DbgAssert(m->dims <= 2);
|
|
2142
|
+
if (m->isContinuous()) {
|
|
2143
|
+
ptrdiff_t ofs = (const _Tp *)ptr - (const _Tp *)m->data;
|
|
2144
|
+
int y = (int)(ofs / m->cols);
|
|
2145
|
+
int x = (int)(ofs - (ptrdiff_t)y * m->cols);
|
|
2146
|
+
return Point(x, y);
|
|
2147
|
+
} else {
|
|
2148
|
+
ptrdiff_t ofs = (uchar *)ptr - m->data;
|
|
2149
|
+
int y = (int)(ofs / m->step);
|
|
2150
|
+
int x = (int)((ofs - y * m->step) / sizeof(_Tp));
|
|
2151
|
+
return Point(x, y);
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
template <typename _Tp>
|
|
2156
|
+
static inline bool operator==(const MatConstIterator_<_Tp> &a,
|
|
2157
|
+
const MatConstIterator_<_Tp> &b) {
|
|
2158
|
+
return a.m == b.m && a.ptr == b.ptr;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
template <typename _Tp>
|
|
2162
|
+
static inline bool operator!=(const MatConstIterator_<_Tp> &a,
|
|
2163
|
+
const MatConstIterator_<_Tp> &b) {
|
|
2164
|
+
return a.m != b.m || a.ptr != b.ptr;
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
template <typename _Tp>
|
|
2168
|
+
static inline MatConstIterator_<_Tp> operator+(const MatConstIterator_<_Tp> &a,
|
|
2169
|
+
ptrdiff_t ofs) {
|
|
2170
|
+
MatConstIterator t = (const MatConstIterator &)a + ofs;
|
|
2171
|
+
return (MatConstIterator_<_Tp> &)t;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
template <typename _Tp>
|
|
2175
|
+
static inline MatConstIterator_<_Tp>
|
|
2176
|
+
operator+(ptrdiff_t ofs, const MatConstIterator_<_Tp> &a) {
|
|
2177
|
+
MatConstIterator t = (const MatConstIterator &)a + ofs;
|
|
2178
|
+
return (MatConstIterator_<_Tp> &)t;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
template <typename _Tp>
|
|
2182
|
+
static inline MatConstIterator_<_Tp> operator-(const MatConstIterator_<_Tp> &a,
|
|
2183
|
+
ptrdiff_t ofs) {
|
|
2184
|
+
MatConstIterator t = (const MatConstIterator &)a - ofs;
|
|
2185
|
+
return (MatConstIterator_<_Tp> &)t;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
template <typename _Tp>
|
|
2189
|
+
inline const _Tp &MatConstIterator_<_Tp>::operator[](ptrdiff_t i) const {
|
|
2190
|
+
return *(_Tp *)MatConstIterator::operator[](i);
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
//////////////////////////// MatIterator_ ///////////////////////////
|
|
2194
|
+
|
|
2195
|
+
template <typename _Tp>
|
|
2196
|
+
inline MatIterator_<_Tp>::MatIterator_() : MatConstIterator_<_Tp>() {}
|
|
2197
|
+
|
|
2198
|
+
template <typename _Tp>
|
|
2199
|
+
inline MatIterator_<_Tp>::MatIterator_(Mat_<_Tp> *_m)
|
|
2200
|
+
: MatConstIterator_<_Tp>(_m) {}
|
|
2201
|
+
|
|
2202
|
+
template <typename _Tp>
|
|
2203
|
+
inline MatIterator_<_Tp>::MatIterator_(Mat_<_Tp> *_m, int _row, int _col)
|
|
2204
|
+
: MatConstIterator_<_Tp>(_m, _row, _col) {}
|
|
2205
|
+
|
|
2206
|
+
template <typename _Tp>
|
|
2207
|
+
inline MatIterator_<_Tp>::MatIterator_(Mat_<_Tp> *_m, Point _pt)
|
|
2208
|
+
: MatConstIterator_<_Tp>(_m, _pt) {}
|
|
2209
|
+
|
|
2210
|
+
template <typename _Tp>
|
|
2211
|
+
inline MatIterator_<_Tp>::MatIterator_(Mat_<_Tp> *_m, const int *_idx)
|
|
2212
|
+
: MatConstIterator_<_Tp>(_m, _idx) {}
|
|
2213
|
+
|
|
2214
|
+
template <typename _Tp>
|
|
2215
|
+
inline MatIterator_<_Tp>::MatIterator_(const MatIterator_ &it)
|
|
2216
|
+
: MatConstIterator_<_Tp>(it) {}
|
|
2217
|
+
|
|
2218
|
+
template <typename _Tp>
|
|
2219
|
+
inline MatIterator_<_Tp> &
|
|
2220
|
+
MatIterator_<_Tp>::operator=(const MatIterator_<_Tp> &it) {
|
|
2221
|
+
MatConstIterator::operator=(it);
|
|
2222
|
+
return *this;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
template <typename _Tp> inline _Tp &MatIterator_<_Tp>::operator*() const {
|
|
2226
|
+
return *(_Tp *)(this->ptr);
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
template <typename _Tp>
|
|
2230
|
+
inline MatIterator_<_Tp> &MatIterator_<_Tp>::operator+=(ptrdiff_t ofs) {
|
|
2231
|
+
MatConstIterator::operator+=(ofs);
|
|
2232
|
+
return *this;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
template <typename _Tp>
|
|
2236
|
+
inline MatIterator_<_Tp> &MatIterator_<_Tp>::operator-=(ptrdiff_t ofs) {
|
|
2237
|
+
MatConstIterator::operator+=(-ofs);
|
|
2238
|
+
return *this;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
template <typename _Tp>
|
|
2242
|
+
inline MatIterator_<_Tp> &MatIterator_<_Tp>::operator--() {
|
|
2243
|
+
MatConstIterator::operator--();
|
|
2244
|
+
return *this;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
template <typename _Tp>
|
|
2248
|
+
inline MatIterator_<_Tp> MatIterator_<_Tp>::operator--(int) {
|
|
2249
|
+
MatIterator_ b = *this;
|
|
2250
|
+
MatConstIterator::operator--();
|
|
2251
|
+
return b;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
template <typename _Tp>
|
|
2255
|
+
inline MatIterator_<_Tp> &MatIterator_<_Tp>::operator++() {
|
|
2256
|
+
MatConstIterator::operator++();
|
|
2257
|
+
return *this;
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
template <typename _Tp>
|
|
2261
|
+
inline MatIterator_<_Tp> MatIterator_<_Tp>::operator++(int) {
|
|
2262
|
+
MatIterator_ b = *this;
|
|
2263
|
+
MatConstIterator::operator++();
|
|
2264
|
+
return b;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
template <typename _Tp>
|
|
2268
|
+
inline _Tp &MatIterator_<_Tp>::operator[](ptrdiff_t i) const {
|
|
2269
|
+
return *(*this + i);
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
template <typename _Tp>
|
|
2273
|
+
static inline bool operator==(const MatIterator_<_Tp> &a,
|
|
2274
|
+
const MatIterator_<_Tp> &b) {
|
|
2275
|
+
return a.m == b.m && a.ptr == b.ptr;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
template <typename _Tp>
|
|
2279
|
+
static inline bool operator!=(const MatIterator_<_Tp> &a,
|
|
2280
|
+
const MatIterator_<_Tp> &b) {
|
|
2281
|
+
return a.m != b.m || a.ptr != b.ptr;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
template <typename _Tp>
|
|
2285
|
+
static inline MatIterator_<_Tp> operator+(const MatIterator_<_Tp> &a,
|
|
2286
|
+
ptrdiff_t ofs) {
|
|
2287
|
+
MatConstIterator t = (const MatConstIterator &)a + ofs;
|
|
2288
|
+
return (MatIterator_<_Tp> &)t;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
template <typename _Tp>
|
|
2292
|
+
static inline MatIterator_<_Tp> operator+(ptrdiff_t ofs,
|
|
2293
|
+
const MatIterator_<_Tp> &a) {
|
|
2294
|
+
MatConstIterator t = (const MatConstIterator &)a + ofs;
|
|
2295
|
+
return (MatIterator_<_Tp> &)t;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
template <typename _Tp>
|
|
2299
|
+
static inline MatIterator_<_Tp> operator-(const MatIterator_<_Tp> &a,
|
|
2300
|
+
ptrdiff_t ofs) {
|
|
2301
|
+
MatConstIterator t = (const MatConstIterator &)a - ofs;
|
|
2302
|
+
return (MatIterator_<_Tp> &)t;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
/////////////////////// SparseMatConstIterator //////////////////////
|
|
2306
|
+
|
|
2307
|
+
inline SparseMatConstIterator::SparseMatConstIterator()
|
|
2308
|
+
: m(0), hashidx(0), ptr(0) {}
|
|
2309
|
+
|
|
2310
|
+
inline SparseMatConstIterator::SparseMatConstIterator(
|
|
2311
|
+
const SparseMatConstIterator &it)
|
|
2312
|
+
: m(it.m), hashidx(it.hashidx), ptr(it.ptr) {}
|
|
2313
|
+
|
|
2314
|
+
inline SparseMatConstIterator &
|
|
2315
|
+
SparseMatConstIterator::operator=(const SparseMatConstIterator &it) {
|
|
2316
|
+
if (this != &it) {
|
|
2317
|
+
m = it.m;
|
|
2318
|
+
hashidx = it.hashidx;
|
|
2319
|
+
ptr = it.ptr;
|
|
2320
|
+
}
|
|
2321
|
+
return *this;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
template <typename _Tp>
|
|
2325
|
+
inline const _Tp &SparseMatConstIterator::value() const {
|
|
2326
|
+
return *(const _Tp *)ptr;
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
inline const SparseMat::Node *SparseMatConstIterator::node() const {
|
|
2330
|
+
return (ptr && m && m->hdr)
|
|
2331
|
+
? (const SparseMat::Node *)(const void *)(ptr -
|
|
2332
|
+
m->hdr->valueOffset)
|
|
2333
|
+
: 0;
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
inline SparseMatConstIterator SparseMatConstIterator::operator++(int) {
|
|
2337
|
+
SparseMatConstIterator it = *this;
|
|
2338
|
+
++*this;
|
|
2339
|
+
return it;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
inline void SparseMatConstIterator::seekEnd() {
|
|
2343
|
+
if (m && m->hdr) {
|
|
2344
|
+
hashidx = m->hdr->hashtab.size();
|
|
2345
|
+
ptr = 0;
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
static inline bool operator==(const SparseMatConstIterator &it1,
|
|
2350
|
+
const SparseMatConstIterator &it2) {
|
|
2351
|
+
return it1.m == it2.m && it1.ptr == it2.ptr;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
static inline bool operator!=(const SparseMatConstIterator &it1,
|
|
2355
|
+
const SparseMatConstIterator &it2) {
|
|
2356
|
+
return !(it1 == it2);
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
///////////////////////// SparseMatIterator /////////////////////////
|
|
2360
|
+
|
|
2361
|
+
inline SparseMatIterator::SparseMatIterator() {}
|
|
2362
|
+
|
|
2363
|
+
inline SparseMatIterator::SparseMatIterator(SparseMat *_m)
|
|
2364
|
+
: SparseMatConstIterator(_m) {}
|
|
2365
|
+
|
|
2366
|
+
inline SparseMatIterator::SparseMatIterator(const SparseMatIterator &it)
|
|
2367
|
+
: SparseMatConstIterator(it) {}
|
|
2368
|
+
|
|
2369
|
+
inline SparseMatIterator &
|
|
2370
|
+
SparseMatIterator::operator=(const SparseMatIterator &it) {
|
|
2371
|
+
(SparseMatConstIterator &)*this = it;
|
|
2372
|
+
return *this;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
template <typename _Tp> inline _Tp &SparseMatIterator::value() const {
|
|
2376
|
+
return *(_Tp *)ptr;
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
inline SparseMat::Node *SparseMatIterator::node() const {
|
|
2380
|
+
return (SparseMat::Node *)SparseMatConstIterator::node();
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
inline SparseMatIterator &SparseMatIterator::operator++() {
|
|
2384
|
+
SparseMatConstIterator::operator++();
|
|
2385
|
+
return *this;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
inline SparseMatIterator SparseMatIterator::operator++(int) {
|
|
2389
|
+
SparseMatIterator it = *this;
|
|
2390
|
+
++*this;
|
|
2391
|
+
return it;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
////////////////////// SparseMatConstIterator_ //////////////////////
|
|
2395
|
+
|
|
2396
|
+
template <typename _Tp>
|
|
2397
|
+
inline SparseMatConstIterator_<_Tp>::SparseMatConstIterator_() {}
|
|
2398
|
+
|
|
2399
|
+
template <typename _Tp>
|
|
2400
|
+
inline SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(
|
|
2401
|
+
const SparseMat_<_Tp> *_m)
|
|
2402
|
+
: SparseMatConstIterator(_m) {}
|
|
2403
|
+
|
|
2404
|
+
template <typename _Tp>
|
|
2405
|
+
inline SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(
|
|
2406
|
+
const SparseMat *_m)
|
|
2407
|
+
: SparseMatConstIterator(_m) {
|
|
2408
|
+
CV_Assert(_m->type() == traits::Type<_Tp>::value);
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
template <typename _Tp>
|
|
2412
|
+
inline SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(
|
|
2413
|
+
const SparseMatConstIterator_<_Tp> &it)
|
|
2414
|
+
: SparseMatConstIterator(it) {}
|
|
2415
|
+
|
|
2416
|
+
template <typename _Tp>
|
|
2417
|
+
inline SparseMatConstIterator_<_Tp> &SparseMatConstIterator_<_Tp>::operator=(
|
|
2418
|
+
const SparseMatConstIterator_<_Tp> &it) {
|
|
2419
|
+
return reinterpret_cast<SparseMatConstIterator_<_Tp> &>(
|
|
2420
|
+
*reinterpret_cast<SparseMatConstIterator *>(this) =
|
|
2421
|
+
reinterpret_cast<const SparseMatConstIterator &>(it));
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
template <typename _Tp>
|
|
2425
|
+
inline const _Tp &SparseMatConstIterator_<_Tp>::operator*() const {
|
|
2426
|
+
return *(const _Tp *)this->ptr;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
template <typename _Tp>
|
|
2430
|
+
inline SparseMatConstIterator_<_Tp> &
|
|
2431
|
+
SparseMatConstIterator_<_Tp>::operator++() {
|
|
2432
|
+
SparseMatConstIterator::operator++();
|
|
2433
|
+
return *this;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
template <typename _Tp>
|
|
2437
|
+
inline SparseMatConstIterator_<_Tp>
|
|
2438
|
+
SparseMatConstIterator_<_Tp>::operator++(int) {
|
|
2439
|
+
SparseMatConstIterator_<_Tp> it = *this;
|
|
2440
|
+
SparseMatConstIterator::operator++();
|
|
2441
|
+
return it;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
///////////////////////// SparseMatIterator_ ////////////////////////
|
|
2445
|
+
|
|
2446
|
+
template <typename _Tp> inline SparseMatIterator_<_Tp>::SparseMatIterator_() {}
|
|
2447
|
+
|
|
2448
|
+
template <typename _Tp>
|
|
2449
|
+
inline SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat_<_Tp> *_m)
|
|
2450
|
+
: SparseMatConstIterator_<_Tp>(_m) {}
|
|
2451
|
+
|
|
2452
|
+
template <typename _Tp>
|
|
2453
|
+
inline SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat *_m)
|
|
2454
|
+
: SparseMatConstIterator_<_Tp>(_m) {}
|
|
2455
|
+
|
|
2456
|
+
template <typename _Tp>
|
|
2457
|
+
inline SparseMatIterator_<_Tp>::SparseMatIterator_(
|
|
2458
|
+
const SparseMatIterator_<_Tp> &it)
|
|
2459
|
+
: SparseMatConstIterator_<_Tp>(it) {}
|
|
2460
|
+
|
|
2461
|
+
template <typename _Tp>
|
|
2462
|
+
inline SparseMatIterator_<_Tp> &
|
|
2463
|
+
SparseMatIterator_<_Tp>::operator=(const SparseMatIterator_<_Tp> &it) {
|
|
2464
|
+
return reinterpret_cast<SparseMatIterator_<_Tp> &>(
|
|
2465
|
+
*reinterpret_cast<SparseMatConstIterator *>(this) =
|
|
2466
|
+
reinterpret_cast<const SparseMatConstIterator &>(it));
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
template <typename _Tp> inline _Tp &SparseMatIterator_<_Tp>::operator*() const {
|
|
2470
|
+
return *(_Tp *)this->ptr;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
template <typename _Tp>
|
|
2474
|
+
inline SparseMatIterator_<_Tp> &SparseMatIterator_<_Tp>::operator++() {
|
|
2475
|
+
SparseMatConstIterator::operator++();
|
|
2476
|
+
return *this;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
template <typename _Tp>
|
|
2480
|
+
inline SparseMatIterator_<_Tp> SparseMatIterator_<_Tp>::operator++(int) {
|
|
2481
|
+
SparseMatIterator_<_Tp> it = *this;
|
|
2482
|
+
SparseMatConstIterator::operator++();
|
|
2483
|
+
return it;
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
//////////////////////// MatCommaInitializer_ ///////////////////////
|
|
2487
|
+
|
|
2488
|
+
template <typename _Tp>
|
|
2489
|
+
inline MatCommaInitializer_<_Tp>::MatCommaInitializer_(Mat_<_Tp> *_m)
|
|
2490
|
+
: it(_m) {}
|
|
2491
|
+
|
|
2492
|
+
template <typename _Tp>
|
|
2493
|
+
template <typename T2>
|
|
2494
|
+
inline MatCommaInitializer_<_Tp> &MatCommaInitializer_<_Tp>::operator,(T2 v) {
|
|
2495
|
+
CV_DbgAssert(this->it < ((const Mat_<_Tp> *)this->it.m)->end());
|
|
2496
|
+
*this->it = _Tp(v);
|
|
2497
|
+
++this->it;
|
|
2498
|
+
return *this;
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
template <typename _Tp>
|
|
2502
|
+
inline MatCommaInitializer_<_Tp>::operator Mat_<_Tp>() const {
|
|
2503
|
+
CV_DbgAssert(this->it == ((const Mat_<_Tp> *)this->it.m)->end());
|
|
2504
|
+
return Mat_<_Tp>(*this->it.m);
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
template <typename _Tp, typename T2>
|
|
2508
|
+
static inline MatCommaInitializer_<_Tp> operator<<(const Mat_<_Tp> &m, T2 val) {
|
|
2509
|
+
MatCommaInitializer_<_Tp> commaInitializer((Mat_<_Tp> *)&m);
|
|
2510
|
+
return (commaInitializer, val);
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
///////////////////////// Matrix Expressions ////////////////////////
|
|
2514
|
+
|
|
2515
|
+
inline Mat &Mat::operator=(const MatExpr &e) {
|
|
2516
|
+
e.op->assign(e, *this);
|
|
2517
|
+
return *this;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
template <typename _Tp> inline Mat_<_Tp>::Mat_(const MatExpr &e) {
|
|
2521
|
+
e.op->assign(e, *this, traits::Type<_Tp>::value);
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
template <typename _Tp>
|
|
2525
|
+
inline Mat_<_Tp> &Mat_<_Tp>::operator=(const MatExpr &e) {
|
|
2526
|
+
e.op->assign(e, *this, traits::Type<_Tp>::value);
|
|
2527
|
+
return *this;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
template <typename _Tp> inline MatExpr Mat_<_Tp>::zeros(int rows, int cols) {
|
|
2531
|
+
return Mat::zeros(rows, cols, traits::Type<_Tp>::value);
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
template <typename _Tp> inline MatExpr Mat_<_Tp>::zeros(Size sz) {
|
|
2535
|
+
return Mat::zeros(sz, traits::Type<_Tp>::value);
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
template <typename _Tp> inline MatExpr Mat_<_Tp>::ones(int rows, int cols) {
|
|
2539
|
+
return Mat::ones(rows, cols, traits::Type<_Tp>::value);
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
template <typename _Tp> inline MatExpr Mat_<_Tp>::ones(Size sz) {
|
|
2543
|
+
return Mat::ones(sz, traits::Type<_Tp>::value);
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
template <typename _Tp> inline MatExpr Mat_<_Tp>::eye(int rows, int cols) {
|
|
2547
|
+
return Mat::eye(rows, cols, traits::Type<_Tp>::value);
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
template <typename _Tp> inline MatExpr Mat_<_Tp>::eye(Size sz) {
|
|
2551
|
+
return Mat::eye(sz, traits::Type<_Tp>::value);
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
inline MatExpr::MatExpr()
|
|
2555
|
+
: op(0), flags(0), a(Mat()), b(Mat()), c(Mat()), alpha(0), beta(0), s() {}
|
|
2556
|
+
|
|
2557
|
+
inline MatExpr::MatExpr(const MatOp *_op, int _flags, const Mat &_a,
|
|
2558
|
+
const Mat &_b, const Mat &_c, double _alpha,
|
|
2559
|
+
double _beta, const Scalar &_s)
|
|
2560
|
+
: op(_op), flags(_flags), a(_a), b(_b), c(_c), alpha(_alpha), beta(_beta),
|
|
2561
|
+
s(_s) {}
|
|
2562
|
+
|
|
2563
|
+
inline MatExpr::operator Mat() const {
|
|
2564
|
+
Mat m;
|
|
2565
|
+
op->assign(*this, m);
|
|
2566
|
+
return m;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
template <typename _Tp> inline MatExpr::operator Mat_<_Tp>() const {
|
|
2570
|
+
Mat_<_Tp> m;
|
|
2571
|
+
op->assign(*this, m, traits::Type<_Tp>::value);
|
|
2572
|
+
return m;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
template <typename _Tp>
|
|
2576
|
+
static inline MatExpr min(const Mat_<_Tp> &a, const Mat_<_Tp> &b) {
|
|
2577
|
+
return cv::min((const Mat &)a, (const Mat &)b);
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
template <typename _Tp>
|
|
2581
|
+
static inline MatExpr min(const Mat_<_Tp> &a, double s) {
|
|
2582
|
+
return cv::min((const Mat &)a, s);
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
template <typename _Tp>
|
|
2586
|
+
static inline MatExpr min(double s, const Mat_<_Tp> &a) {
|
|
2587
|
+
return cv::min((const Mat &)a, s);
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
template <typename _Tp>
|
|
2591
|
+
static inline MatExpr max(const Mat_<_Tp> &a, const Mat_<_Tp> &b) {
|
|
2592
|
+
return cv::max((const Mat &)a, (const Mat &)b);
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
template <typename _Tp>
|
|
2596
|
+
static inline MatExpr max(const Mat_<_Tp> &a, double s) {
|
|
2597
|
+
return cv::max((const Mat &)a, s);
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
template <typename _Tp>
|
|
2601
|
+
static inline MatExpr max(double s, const Mat_<_Tp> &a) {
|
|
2602
|
+
return cv::max((const Mat &)a, s);
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
template <typename _Tp> static inline MatExpr abs(const Mat_<_Tp> &m) {
|
|
2606
|
+
return cv::abs((const Mat &)m);
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
static inline Mat &operator+=(Mat &a, const MatExpr &b) {
|
|
2610
|
+
b.op->augAssignAdd(b, a);
|
|
2611
|
+
return a;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
static inline const Mat &operator+=(const Mat &a, const MatExpr &b) {
|
|
2615
|
+
b.op->augAssignAdd(b, (Mat &)a);
|
|
2616
|
+
return a;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
template <typename _Tp>
|
|
2620
|
+
static inline Mat_<_Tp> &operator+=(Mat_<_Tp> &a, const MatExpr &b) {
|
|
2621
|
+
b.op->augAssignAdd(b, a);
|
|
2622
|
+
return a;
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
template <typename _Tp>
|
|
2626
|
+
static inline const Mat_<_Tp> &operator+=(const Mat_<_Tp> &a,
|
|
2627
|
+
const MatExpr &b) {
|
|
2628
|
+
b.op->augAssignAdd(b, (Mat &)a);
|
|
2629
|
+
return a;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
static inline Mat &operator-=(Mat &a, const MatExpr &b) {
|
|
2633
|
+
b.op->augAssignSubtract(b, a);
|
|
2634
|
+
return a;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
static inline const Mat &operator-=(const Mat &a, const MatExpr &b) {
|
|
2638
|
+
b.op->augAssignSubtract(b, (Mat &)a);
|
|
2639
|
+
return a;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
template <typename _Tp>
|
|
2643
|
+
static inline Mat_<_Tp> &operator-=(Mat_<_Tp> &a, const MatExpr &b) {
|
|
2644
|
+
b.op->augAssignSubtract(b, a);
|
|
2645
|
+
return a;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
template <typename _Tp>
|
|
2649
|
+
static inline const Mat_<_Tp> &operator-=(const Mat_<_Tp> &a,
|
|
2650
|
+
const MatExpr &b) {
|
|
2651
|
+
b.op->augAssignSubtract(b, (Mat &)a);
|
|
2652
|
+
return a;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
static inline Mat &operator*=(Mat &a, const MatExpr &b) {
|
|
2656
|
+
b.op->augAssignMultiply(b, a);
|
|
2657
|
+
return a;
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
static inline const Mat &operator*=(const Mat &a, const MatExpr &b) {
|
|
2661
|
+
b.op->augAssignMultiply(b, (Mat &)a);
|
|
2662
|
+
return a;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
template <typename _Tp>
|
|
2666
|
+
static inline Mat_<_Tp> &operator*=(Mat_<_Tp> &a, const MatExpr &b) {
|
|
2667
|
+
b.op->augAssignMultiply(b, a);
|
|
2668
|
+
return a;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
template <typename _Tp>
|
|
2672
|
+
static inline const Mat_<_Tp> &operator*=(const Mat_<_Tp> &a,
|
|
2673
|
+
const MatExpr &b) {
|
|
2674
|
+
b.op->augAssignMultiply(b, (Mat &)a);
|
|
2675
|
+
return a;
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
static inline Mat &operator/=(Mat &a, const MatExpr &b) {
|
|
2679
|
+
b.op->augAssignDivide(b, a);
|
|
2680
|
+
return a;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
static inline const Mat &operator/=(const Mat &a, const MatExpr &b) {
|
|
2684
|
+
b.op->augAssignDivide(b, (Mat &)a);
|
|
2685
|
+
return a;
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
template <typename _Tp>
|
|
2689
|
+
static inline Mat_<_Tp> &operator/=(Mat_<_Tp> &a, const MatExpr &b) {
|
|
2690
|
+
b.op->augAssignDivide(b, a);
|
|
2691
|
+
return a;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
template <typename _Tp>
|
|
2695
|
+
static inline const Mat_<_Tp> &operator/=(const Mat_<_Tp> &a,
|
|
2696
|
+
const MatExpr &b) {
|
|
2697
|
+
b.op->augAssignDivide(b, (Mat &)a);
|
|
2698
|
+
return a;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
//////////////////////////////// UMat ////////////////////////////////
|
|
2702
|
+
|
|
2703
|
+
inline bool UMatData::hostCopyObsolete() const {
|
|
2704
|
+
return (flags & HOST_COPY_OBSOLETE) != 0;
|
|
2705
|
+
}
|
|
2706
|
+
inline bool UMatData::deviceCopyObsolete() const {
|
|
2707
|
+
return (flags & DEVICE_COPY_OBSOLETE) != 0;
|
|
2708
|
+
}
|
|
2709
|
+
inline bool UMatData::deviceMemMapped() const {
|
|
2710
|
+
return (flags & DEVICE_MEM_MAPPED) != 0;
|
|
2711
|
+
}
|
|
2712
|
+
inline bool UMatData::copyOnMap() const { return (flags & COPY_ON_MAP) != 0; }
|
|
2713
|
+
inline bool UMatData::tempUMat() const { return (flags & TEMP_UMAT) != 0; }
|
|
2714
|
+
inline bool UMatData::tempCopiedUMat() const {
|
|
2715
|
+
return (flags & TEMP_COPIED_UMAT) == TEMP_COPIED_UMAT;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
inline void UMatData::markDeviceMemMapped(bool flag) {
|
|
2719
|
+
if (flag)
|
|
2720
|
+
flags |= DEVICE_MEM_MAPPED;
|
|
2721
|
+
else
|
|
2722
|
+
flags &= ~DEVICE_MEM_MAPPED;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
inline void UMatData::markHostCopyObsolete(bool flag) {
|
|
2726
|
+
if (flag)
|
|
2727
|
+
flags |= HOST_COPY_OBSOLETE;
|
|
2728
|
+
else
|
|
2729
|
+
flags &= ~HOST_COPY_OBSOLETE;
|
|
2730
|
+
}
|
|
2731
|
+
inline void UMatData::markDeviceCopyObsolete(bool flag) {
|
|
2732
|
+
if (flag)
|
|
2733
|
+
flags |= DEVICE_COPY_OBSOLETE;
|
|
2734
|
+
else
|
|
2735
|
+
flags &= ~DEVICE_COPY_OBSOLETE;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
//! @endcond
|
|
2739
|
+
|
|
2740
|
+
static inline void swap(MatExpr &a, MatExpr &b) { a.swap(b); }
|
|
2741
|
+
|
|
2742
|
+
} // namespace cv
|
|
2743
|
+
|
|
2744
|
+
#ifdef _MSC_VER
|
|
2745
|
+
#pragma warning(pop)
|
|
2746
|
+
#endif
|
|
2747
|
+
|
|
2748
|
+
#ifdef CV_DISABLE_CLANG_ENUM_WARNINGS
|
|
2749
|
+
#undef CV_DISABLE_CLANG_ENUM_WARNINGS
|
|
2750
|
+
#pragma clang diagnostic pop
|
|
2751
|
+
#endif
|
|
2752
|
+
|
|
2753
|
+
#endif
|